-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Text Component: Typescript'n (#54953)
* No boolean? * Easy type changes and moves styles folder to new location, was clashing in code editor. * Types component * Quick pass on utils and hook * Story to TSX * Adds back boolean type and removes unneeded as string. * First pass on PR comments * Replaces lowercaseProps function with clearer version. * Adds changelog * options type in utils for createHighlighterText converted out of jsDocs * Move native styles back * Removes boolean from adjustLineHeightForInnerControls. * First pass on storybook upgrade * Pass on headings * Exports and imports the correct one.
- Loading branch information
Showing
11 changed files
with
148 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { Meta, StoryFn } from '@storybook/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { Text } from '../component'; | ||
|
||
const meta: Meta< typeof Text > = { | ||
component: Text, | ||
title: 'Components (Experimental)/Text', | ||
argTypes: { | ||
as: { control: { type: 'text' } }, | ||
color: { control: { type: 'color' } }, | ||
display: { control: { type: 'text' } }, | ||
lineHeight: { control: { type: 'text' } }, | ||
letterSpacing: { control: { type: 'text' } }, | ||
optimizeReadabilityFor: { control: { type: 'color' } }, | ||
size: { control: { type: 'text' } }, | ||
variant: { | ||
options: [ undefined, 'muted' ], | ||
control: { type: 'select' }, | ||
}, | ||
weight: { control: { type: 'text' } }, | ||
}, | ||
parameters: { | ||
actions: { argTypesRegex: '^on.*' }, | ||
controls: { expanded: true }, | ||
docs: { canvas: { sourceState: 'shown' } }, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
const Template: StoryFn< typeof Text > = ( props ) => { | ||
return <Text { ...props } />; | ||
}; | ||
|
||
export const Default = Template.bind( {} ); | ||
Default.args = { | ||
children: 'Code is poetry', | ||
}; | ||
|
||
export const Truncate = Template.bind( {} ); | ||
Truncate.args = { | ||
children: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut | ||
facilisis dictum tortor, eu tincidunt justo scelerisque tincidunt. | ||
Duis semper dui id augue malesuada, ut feugiat nisi aliquam. | ||
Vestibulum venenatis diam sem, finibus dictum massa semper in. Nulla | ||
facilisi. Nunc vulputate faucibus diam, in lobortis arcu ornare vel. | ||
In dignissim nunc sed facilisis finibus. Etiam imperdiet mattis | ||
arcu, sed rutrum sapien blandit gravida. Aenean sollicitudin neque | ||
eget enim blandit, sit amet rutrum leo vehicula. Nunc malesuada | ||
ultricies eros ut faucibus. Aliquam erat volutpat. Nulla nec feugiat | ||
risus. Vivamus iaculis dui aliquet ante ultricies feugiat. | ||
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices | ||
posuere cubilia curae; Vivamus nec pretium velit, sit amet | ||
consectetur ante. Praesent porttitor ex eget fermentum mattis.`, | ||
numberOfLines: 2, | ||
truncate: true, | ||
}; | ||
|
||
export const Highlight = Template.bind( {} ); | ||
Highlight.args = { | ||
children: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut | ||
facilisis dictum tortor, eu tincidunt justo scelerisque tincidunt. | ||
Duis semper dui id augue malesuada, ut feugiat nisi aliquam. | ||
Vestibulum venenatis diam sem, finibus dictum massa semper in. Nulla | ||
facilisi. Nunc vulputate faucibus diam, in lobortis arcu ornare vel. | ||
In dignissim nunc sed facilisis finibus. Etiam imperdiet mattis | ||
arcu, sed rutrum sapien blandit gravida. Aenean sollicitudin neque | ||
eget enim blandit, sit amet rutrum leo vehicula. Nunc malesuada | ||
ultricies eros ut faucibus. Aliquam erat volutpat. Nulla nec feugiat | ||
risus. Vivamus iaculis dui aliquet ante ultricies feugiat. | ||
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices | ||
posuere cubilia curae; Vivamus nec pretium velit, sit amet | ||
consectetur ante. Praesent porttitor ex eget fermentum mattis.`, | ||
highlightWords: [ 'con' ], | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.