Skip to content

Commit

Permalink
Release@main
Browse files Browse the repository at this point in the history
  • Loading branch information
primeinteger authored Jan 13, 2025
2 parents ffdf919 + 4c831e2 commit 5dcf7d0
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"npmClient": "npm",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"command": {
"version": {
"allowBranch": ["main", "next", "development"],
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-components-react",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"description": "A basic set of components to use with Studio Experiences",
"homepage": "https://github.com/contentful/experience-builder/tree/next/packages/components#readme",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/components/Text/Text.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.cf-text {
white-space: pre-line;
}

.cf-text-link .cf-text {
margin: 0;
}
12 changes: 11 additions & 1 deletion packages/components/src/components/Text/Text.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Text', () => {
cy.mount(
<Text value="My Text" data-foo="bar">
Children text
</Text>
</Text>,
);
cy.get('p').should('have.attr', 'data-foo', 'bar');
});
Expand All @@ -40,4 +40,14 @@ describe('Text', () => {
cy.mount(<Text value="My Text" />);
cy.get('p').should('have.class', 'cf-text');
});

it('has a wrapping anchor tag with the class "cf-text-link" when a url is provided', () => {
cy.mount(<Text value="My Text" url="#link" />);
cy.get('a').should('have.class', 'cf-text-link');
});

it('when className and url are provided, the className should be added to the anchor tag', () => {
cy.mount(<Text value="My Text" className="custom-class" url="#link" />);
cy.get('a').should('have.class', 'custom-class');
});
});
28 changes: 15 additions & 13 deletions packages/components/src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ export const Text: React.FC<TextProps> = ({
onClick,
...props
}) => {
const Tag = as;

if (url) {
return (
<a
className={combineClasses('cf-text-link', className)}
href={url}
{...(target ? { target } : {})}
{...props}>
<Tag className="cf-text">{value ? value : children}</Tag>
</a>
);
}

const handleClick = (event: React.MouseEvent<HTMLElement>) => {
if (onNavigate && url) {
event.preventDefault();
Expand All @@ -91,9 +105,7 @@ export const Text: React.FC<TextProps> = ({
onClick && onClick(event);
};

const Tag = as;

const textAsTag = (
return (
<Tag
className={combineClasses('cf-text', className)}
onClick={handleClick}
Expand All @@ -103,14 +115,4 @@ export const Text: React.FC<TextProps> = ({
{value ? value : children}
</Tag>
);

if (!url) {
return textAsTag;
}

return (
<a className="cf-text-link" href={url} {...(target ? { target } : {})}>
{textAsTag}
</a>
);
};
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-core",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"description": "",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-contentful-studio-experiences/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-contentful-studio-experiences",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"description": "A CLI tool to get up and running with Contentful Studio Experiences quickly",
"homepage": "https://github.com/contentful/experience-builder/tree/next/packages/create-contentful-studio-experiences#readme",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/experience-builder-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-sdk-react",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"main": "./dist/index.js",
"module": "./dist/index.js",
"typings": "./dist/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-validators",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/visual-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentful/experiences-visual-editor-react",
"version": "1.28.0",
"version": "1.28.1-beta.0",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down

0 comments on commit 5dcf7d0

Please sign in to comment.