From 77ed1a5d5976db8c08041f83e3391abda96908d2 Mon Sep 17 00:00:00 2001 From: andresin87 Date: Mon, 20 Jan 2025 09:09:21 +0100 Subject: [PATCH] docs(components/atom/label): label documentation articles --- .../label/demo/articles/ArticleFontSize.tsx | 34 ++++++ .../label/demo/articles/ArticleInline.tsx | 44 +++++++ .../atom/label/demo/articles/ArticleType.tsx | 36 ++++++ components/atom/label/demo/index.tsx | 111 ++---------------- components/atom/label/demo/settings.js | 25 ++++ package-lock.json | 2 +- 6 files changed, 148 insertions(+), 104 deletions(-) create mode 100644 components/atom/label/demo/articles/ArticleFontSize.tsx create mode 100644 components/atom/label/demo/articles/ArticleInline.tsx create mode 100644 components/atom/label/demo/articles/ArticleType.tsx create mode 100644 components/atom/label/demo/settings.js diff --git a/components/atom/label/demo/articles/ArticleFontSize.tsx b/components/atom/label/demo/articles/ArticleFontSize.tsx new file mode 100644 index 000000000..44841ad4a --- /dev/null +++ b/components/atom/label/demo/articles/ArticleFontSize.tsx @@ -0,0 +1,34 @@ +import {Article, Box, Cell, Code, Grid, H2, Paragraph} from '@s-ui/documentation-library' +import AtomInput from '@s-ui/react-atom-input' + +import AtomLabel, {type FontSize, AtomLabelFontSizes} from '../../src/index' +import {flexCenteredStyle} from '../settings.js' + +const ArticleFontSize = ({className}: {className?: string}) => { + const labelFontSizes = [['default', undefined], ...Object.entries(AtomLabelFontSizes)] as Array<[string, FontSize]> + return ( +
+

FontSize

+ + The component provides 4 different sizes provided using the fontSize prop + + + {labelFontSizes.map(([key, value], index) => ( + + + + + + + ))} + +
+ ) +} + +export default ArticleFontSize diff --git a/components/atom/label/demo/articles/ArticleInline.tsx b/components/atom/label/demo/articles/ArticleInline.tsx new file mode 100644 index 000000000..71fba8b4a --- /dev/null +++ b/components/atom/label/demo/articles/ArticleInline.tsx @@ -0,0 +1,44 @@ +import {Article, Box, Cell, Code, Grid, H2, Paragraph} from '@s-ui/documentation-library' +import AtomButton from '@s-ui/react-atom-button' +import AtomCheckbox from '@s-ui/react-atom-checkbox' +import AtomInput from '@s-ui/react-atom-input' + +import AtomLabel, {type Inline} from '../../src/index' +import {CheckedIcon, flexCenteredStyle, IndeterminateIcon} from '../settings.js' + +const ArticleInline = ({className}: {className?: string}) => { + return ( +
+

Inline

+ + inline prop can be used to define where teh element is going to be inline positioned. The value + options are 'left' and 'right' + + + {[ + , + , + Button + ].map((component, index) => + ['left', undefined, 'right'].map((value, index) => ( + + + {value === 'right' && component} + + {value !== 'right' && component} + + + )) + )} + +
+ ) +} + +export default ArticleInline diff --git a/components/atom/label/demo/articles/ArticleType.tsx b/components/atom/label/demo/articles/ArticleType.tsx new file mode 100644 index 000000000..1929ea3bf --- /dev/null +++ b/components/atom/label/demo/articles/ArticleType.tsx @@ -0,0 +1,36 @@ +import {Article, Box, Cell, Code, Grid, H2, Paragraph} from '@s-ui/documentation-library' +import AtomInput from '@s-ui/react-atom-input' + +import AtomLabel, {type Type, AtomLabelTypes} from '../../src/index' +import {flexCenteredStyle} from '../settings.js' + +const ArticleType = ({className}: {className?: string}) => { + const labelTypes = [['default', undefined], ...Object.entries(AtomLabelTypes)] as Array<[string, Type]> + + return ( +
+

Type

+ + You can select any of the available predefined types using the type prop. + + + {labelTypes.map(([key, value]: [string, Type], index) => ( + + + + + + + ))} + +
+ ) +} + +export default ArticleType diff --git a/components/atom/label/demo/index.tsx b/components/atom/label/demo/index.tsx index 0ec469a17..bb9e75bdc 100644 --- a/components/atom/label/demo/index.tsx +++ b/components/atom/label/demo/index.tsx @@ -1,36 +1,11 @@ -import {AntDesignIcon, Article, Box, Cell, Code, Grid, H1, H2, Paragraph} from '@s-ui/documentation-library' -import AtomButton from '@s-ui/react-atom-button' -import AtomCheckbox from '@s-ui/react-atom-checkbox' -import AtomIcon from '@s-ui/react-atom-icon' -import AtomInput from '@s-ui/react-atom-input' +import {H1, Paragraph} from '@s-ui/documentation-library' -import AtomLabel, {type FontSize, type Inline, type Type, AtomLabelFontSizes, AtomLabelTypes} from '../src/index' - -const flexCenteredStyle = { - display: 'flex', - justifyContent: 'center', - flexDirection: 'row', - wrap: 'nowrap', - alignItems: 'center', - alignContent: 'center' -} - -const CheckedIcon = () => ( - - - -) - -const IndeterminateIcon = () => ( - - - -) +import ArticleFontSize from './articles/ArticleFontSize' +import ArticleInline from './articles/ArticleInline' +import ArticleType from './articles/ArticleType' +import {CLASS_SECTION} from './settings' const Demo = () => { - const labelTypes = [['default', undefined], ...Object.entries(AtomLabelTypes)] as Array<[string, Type]> - const labelFontSizes = [['default', undefined], ...Object.entries(AtomLabelFontSizes)] as Array<[string, FontSize]> - return (

Label

@@ -38,81 +13,11 @@ const Demo = () => { The Label is the name of the associated field, that explains what is the about. It should be clear, concise and short. -
-

Type

- - You can select any of the avaliable predefined types using the type prop. - - - {labelTypes.map(([key, value], index) => ( - - - - - - - ))} - -
+
-
-

Inline

- - inline prop can be used to define where teh element is going to be inline positioned. The value - options are 'left' and 'right' - - - {[ - , - , - Button - ].map((component, index) => - ['left', undefined, 'right'].map((value, index) => ( - - - {value === 'right' && component} - - {value !== 'right' && component} - - - )) - )} - -
+
-
-

FontSize

- - The component provides 4 diferent sizes provided using the fontSize prop - - - {labelFontSizes.map(([key, value], index) => ( - - - - - - - ))} - -
+
) } diff --git a/components/atom/label/demo/settings.js b/components/atom/label/demo/settings.js new file mode 100644 index 000000000..441ce40df --- /dev/null +++ b/components/atom/label/demo/settings.js @@ -0,0 +1,25 @@ +import {AntDesignIcon} from '@s-ui/documentation-library' +import AtomIcon from '@s-ui/react-atom-icon' + +export const BASE_CLASS_DEMO = `DemoAtomLabel` +export const CLASS_SECTION = `${BASE_CLASS_DEMO}-section` + +export const flexCenteredStyle = { + display: 'flex', + justifyContent: 'center', + wrap: 'nowrap', + alignItems: 'center', + alignContent: 'center' +} + +export const CheckedIcon = () => ( + + + +) + +export const IndeterminateIcon = () => ( + + + +) diff --git a/package-lock.json b/package-lock.json index 0e691e3d7..0c4a120ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -263,7 +263,7 @@ }, "components/atom/label": { "name": "@s-ui/react-atom-label", - "version": "1.25.0", + "version": "1.27.0", "license": "MIT", "dependencies": { "@s-ui/component-dependencies": "1",