import React from 'react' import { type Meta, type StoryObj } from '@storybook/react-vite' import TrimText from './TrimText' import { DocsTemplate } from '../../../.storybook' export default { title: 'Components/Text/TrimText', component: TrimText, parameters: { docs: { page: () => ( The TrimText component is designed to truncate text strings that exceed a specified character limit and add an ellipsis to indicate that the text has been trimmed. When users hover over the truncated text, a tooltip appears, displaying the entire text string. If the original text is shorter than the limit, it will be displayed normally without any truncation. } infoBullets={[ Implement the TrimText component in areas where text content needs to be constrained within a specific character limit, such as titles, descriptions, or user-generated content. , ]} /> ), }, }, } as Meta type Story = StoryObj const Template: Story = { render: (args) => { return }, } const AutoTrimmedTemplate: Story = { render: (args) => { return (
) }, } export const TrimmedText: Story = { ...Template, args: { text: 'This is a really long text string that will need to be trimmed.', limit: 30, }, } export const FullText: Story = { ...Template, args: { text: 'This string has a longer limit.', limit: 100, }, } export const AutoTrimmedLongText: Story = { ...AutoTrimmedTemplate, args: { text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', }, } export const AutoNoTrimmingNeeded: Story = { ...AutoTrimmedTemplate, args: { text: 'A concise message that fits', }, } export const CustomClassExample: Story = { ...Template, args: { text: 'This text has custom styling applied through the customClass prop', limit: 40, customClass: 'text-lg font-bold text-blue', }, } FullText.storyName = 'Full Text - No Tooltip'