|
| 1 | +import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks'; |
| 2 | +// The '!!raw-loader!' syntax is a non-standard, Webpack-specific, syntax. |
| 3 | +// See: https://github.com/webpack-contrib/raw-loader#examples |
| 4 | +// For now, it seems likely Storybook is pretty tied to Webpack, therefore, we are |
| 5 | +// okay with the following Webpack-specific raw loader syntax. It's better to leave |
| 6 | +// the ESLint rule enabled globally, and only thoughtfully disable as needed (e.g. |
| 7 | +// within a Storybook docs page and not within an actual component). |
| 8 | +// This can be revisited in the future if Storybook no longer relies on Webpack. |
| 9 | +// eslint-disable-next-line @cloudfour/import/no-webpack-loader-syntax |
| 10 | +import noWrapDemoSource from '!!raw-loader!./demo/nowrap.twig'; |
| 11 | +import noWrapDemo from './demo/nowrap.twig'; |
| 12 | +// The '!!raw-loader!' syntax is a non-standard, Webpack-specific, syntax. |
| 13 | +// See: https://github.com/webpack-contrib/raw-loader#examples |
| 14 | +// For now, it seems likely Storybook is pretty tied to Webpack, therefore, we are |
| 15 | +// okay with the following Webpack-specific raw loader syntax. It's better to leave |
| 16 | +// the ESLint rule enabled globally, and only thoughtfully disable as needed (e.g. |
| 17 | +// within a Storybook docs page and not within an actual component). |
| 18 | +// This can be revisited in the future if Storybook no longer relies on Webpack. |
| 19 | +// eslint-disable-next-line @cloudfour/import/no-webpack-loader-syntax |
| 20 | +import colorDemoSource from '!!raw-loader!./demo/color.twig'; |
| 21 | +import colorDemo from './demo/color.twig'; |
| 22 | + |
| 23 | +<Meta title="Utilities/Text" /> |
| 24 | + |
| 25 | +# Text |
| 26 | + |
| 27 | +Utilities for controlling text properties. |
| 28 | + |
| 29 | +## White-space nowrap |
| 30 | + |
| 31 | +- `u-text-no-wrap` |
| 32 | + |
| 33 | +Utility for controlling the white-space wrapping of text, applies `white-space: nowrap`. |
| 34 | + |
| 35 | +Notice in the second example how the `some-long-text` text doesn't wrap. |
| 36 | + |
| 37 | +<Canvas> |
| 38 | + <Story |
| 39 | + name="White-space nowrap" |
| 40 | + parameters={{ docs: { source: { code: noWrapDemoSource } } }} |
| 41 | + > |
| 42 | + {(args) => noWrapDemo(args)} |
| 43 | + </Story> |
| 44 | +</Canvas> |
| 45 | + |
| 46 | +## Action text |
| 47 | + |
| 48 | +- `u-text-action` |
| 49 | + |
| 50 | +Utility that changes the text color to the "action" text color. |
| 51 | + |
| 52 | +<Canvas> |
| 53 | + <Story |
| 54 | + name="Action text" |
| 55 | + parameters={{ docs: { source: { code: colorDemoSource } } }} |
| 56 | + > |
| 57 | + {(args) => colorDemo(args)} |
| 58 | + </Story> |
| 59 | +</Canvas> |
0 commit comments