diff --git a/.changeset/loose-times-attend.md b/.changeset/loose-times-attend.md new file mode 100644 index 0000000000..231833732d --- /dev/null +++ b/.changeset/loose-times-attend.md @@ -0,0 +1,5 @@ +--- +'@swisspost/design-system-documentation': patch +--- + +Grouped the text truncation documentation with other text utilities. diff --git a/packages/documentation/cypress/snapshots/utilities/text-truncation.snapshot.ts b/packages/documentation/cypress/snapshots/utilities/text-truncation.snapshot.ts deleted file mode 100644 index 571de0a52d..0000000000 --- a/packages/documentation/cypress/snapshots/utilities/text-truncation.snapshot.ts +++ /dev/null @@ -1,7 +0,0 @@ -describe('Text Truncation', () => { - it('text truncation', () => { - cy.visit('/iframe.html?id=snapshots--text-truncation'); - cy.get('.text-truncation-example', { timeout: 30000 }).should('be.visible'); - cy.percySnapshot('Text Truncation', { widths: [1440] }); - }); -}); diff --git a/packages/documentation/src/stories/utilities/text-truncation/text-truncation.docs.mdx b/packages/documentation/src/stories/utilities/text-truncation/text-truncation.docs.mdx deleted file mode 100644 index fdcae0d212..0000000000 --- a/packages/documentation/src/stories/utilities/text-truncation/text-truncation.docs.mdx +++ /dev/null @@ -1,15 +0,0 @@ -import { Canvas, Controls, Meta } from '@storybook/addon-docs/blocks'; -import * as TextTruncationStories from './text-truncation.stories'; - - - -# Text Truncation - -The `.text-truncate` class helps in truncating long text when it exceeds a specified width. - -## Usage - - -
- This is a long text that should be truncated when it exceeds the defined - max-width. -
-- This is a long text that should be truncated when it exceeds the defined max-width. -
- `; - }, -}; - -export default meta; - -type Story = StoryObj; - -export const Default: Story = {}; diff --git a/packages/documentation/src/stories/utilities/text/text.docs.mdx b/packages/documentation/src/stories/utilities/text/text.docs.mdx index 9ce94814ca..1ce20149d0 100644 --- a/packages/documentation/src/stories/utilities/text/text.docs.mdx +++ b/packages/documentation/src/stories/utilities/text/text.docs.mdx @@ -109,3 +109,9 @@ Transform text with the following text capitalization classes: `.text-lowercase` Decorate text with the following text decoration classes: `text-decoration-underline`, `.text-decoration-line-through` and `.text-decoration-none`. + +### Text Truncation + +The `.text-truncate` class helps in truncating long text when it exceeds a specified width. + + diff --git a/packages/documentation/src/stories/utilities/text/text.snapshot.stories.ts b/packages/documentation/src/stories/utilities/text/text.snapshot.stories.ts index b794c6f01b..201b364260 100644 --- a/packages/documentation/src/stories/utilities/text/text.snapshot.stories.ts +++ b/packages/documentation/src/stories/utilities/text/text.snapshot.stories.ts @@ -82,9 +82,19 @@ function getTextUtility(type: string) { `, )} `; + case 'Text Truncation': + return html` + ${[100, 200, 300, 400].map( + val => + html` ++ This is a long text that should be truncated when it exceeds the defined max-width. +
+ `, + )} + `; } } - export const Text: Story = { render: () => { return schemes( @@ -101,6 +111,7 @@ export const Text: Story = { 'Text transform', 'White space', 'Word wrap break', + 'Text Truncation', ].map( val => html`+ This is a long text that should be truncated when it exceeds the defined max-width. +
+ `, +}; + export const SmallText: StoryObj = { render: () => html`This is normal text
@@ -116,3 +125,4 @@ export const SmallText: StoryObj = {