From 189244c019920d0b35d4a7452f99dfec86eddc55 Mon Sep 17 00:00:00 2001 From: 8845musign Date: Thu, 19 Oct 2023 22:23:15 +0900 Subject: [PATCH 1/7] update cli messages Signed-off-by: 8845musign --- .scaffdog/example.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.scaffdog/example.md b/.scaffdog/example.md index 02cd256..b54a15a 100644 --- a/.scaffdog/example.md +++ b/.scaffdog/example.md @@ -4,8 +4,8 @@ root: '.' output: '**/*' ignore: [] questions: - exampleKey: What is the exampleKey (e.g., stack)? - exampleName: What is the exampleName (e.g., nested)? + exampleKey: What is the exampleKey (e.g., link-button)? + exampleName: What is the exampleName (e.g., with-icon)? --- # `src/components/react/examples/{{ inputs.exampleKey }}/{{ inputs.exampleName | pascal }}.tsx` From 691f4e0b9a7d53b6385482ac1102a7c4452b87a6 Mon Sep 17 00:00:00 2001 From: 8845musign Date: Thu, 19 Oct 2023 22:23:45 +0900 Subject: [PATCH 2/7] refactor name Signed-off-by: 8845musign --- src/components/react/Example.tsx | 14 +++++++------- src/components/react/ExampleSwitcher.tsx | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/react/Example.tsx b/src/components/react/Example.tsx index f72555f..28d5d11 100644 --- a/src/components/react/Example.tsx +++ b/src/components/react/Example.tsx @@ -6,21 +6,21 @@ import type { Example } from '@utils/server'; import type { FC } from 'react'; interface Props { - exampleUrlAndFilePath: Example; + example: Example; } -const Example: FC = ({ exampleUrlAndFilePath }) => { +const Example: FC = ({ example }) => { return (
- + Open Window
@@ -34,9 +34,9 @@ const Example: FC = ({ exampleUrlAndFilePath }) => { margin: '0', }} > - {exampleUrlAndFilePath.code} + {example.code} - +
); diff --git a/src/components/react/ExampleSwitcher.tsx b/src/components/react/ExampleSwitcher.tsx index 7d1a21b..103055c 100644 --- a/src/components/react/ExampleSwitcher.tsx +++ b/src/components/react/ExampleSwitcher.tsx @@ -37,7 +37,7 @@ const ExampleSwitcher: FC = ({ examples }) => { ))} - {currentExample && } + {currentExample && } ); From 8c74969bfd7e0db9a80641a73c94871ac8f1d670 Mon Sep 17 00:00:00 2001 From: 8845musign Date: Thu, 19 Oct 2023 22:25:48 +0900 Subject: [PATCH 3/7] Migration of examples from storybook Signed-off-by: 8845musign --- .../react/examples/accordion/Small.tsx | 12 +++ .../examples/action-half-modal/Customized.tsx | 33 ++++++ .../examples/action-half-modal/Fullscreen.tsx | 24 +++++ .../action-half-modal/NoCloseButton.tsx | 31 ++++++ .../examples/action-half-modal/Secondary.tsx | 32 ++++++ .../examples/action-modal/Customized.tsx | 29 +++++ .../examples/action-modal/FixedHeight.tsx | 26 +++++ .../react/examples/action-modal/Secondary.tsx | 28 +++++ .../react/examples/button/Block.tsx | 26 +++++ .../react/examples/button/Default.tsx | 11 +- .../react/examples/button/Disabled.tsx | 27 +++++ src/components/react/examples/button/Size.tsx | 16 +++ .../react/examples/button/WithIcon.tsx | 89 ++++++++++++++++ .../react/examples/checkbox/Disabled.tsx | 18 ++++ .../react/examples/checkbox/SingleUse.tsx | 17 +++ .../react/examples/checkbox/Size.tsx | 17 +++ .../react/examples/input/Disabled.tsx | 8 ++ .../react/examples/input/IsInvalid.tsx | 8 ++ src/components/react/examples/input/Types.tsx | 81 ++++++++++++++ .../react/examples/link-button/Block.tsx | 26 +++++ .../react/examples/link-button/Default.tsx | 21 +++- .../react/examples/link-button/Disabled.tsx | 29 +++++ .../react/examples/link-button/Size.tsx | 20 ++++ .../react/examples/link-button/WithIcon.tsx | 100 ++++++++++++++++++ .../react/examples/link-card/Default.tsx | 20 ++-- .../react/examples/link-card/WithIcon.tsx | 16 +++ .../examples/message-modal/FixedHeight.tsx | 20 ++++ .../examples/message-modal/OverlayDarker.tsx | 20 ++++ .../examples/message-modal/WithHeader.tsx | 20 ++++ .../react/examples/radio-button/Disabled.tsx | 39 +++++++ .../react/examples/radio-button/Size.tsx | 31 ++++++ .../react/examples/radio-card/Block.tsx | 25 +++++ .../react/examples/radio-card/Default.tsx | 46 +++++--- .../react/examples/select/Disabled.tsx | 16 +++ .../react/examples/select/IsInvalid.tsx | 16 +++ .../stack/BlockLevelElementsToFullWidth.tsx | 29 +++++ .../react/examples/stack/Centralized.tsx | 24 +++++ .../react/examples/stack/Default.tsx | 8 +- .../react/examples/stack/MarkupAsList.tsx | 15 +++ .../react/examples/stack/Nested.tsx | 28 +++++ .../react/examples/stack/PutOnTheEnd.tsx | 15 +++ .../stack/{Horizontal.tsx => Vertical.tsx} | 0 src/components/react/examples/text/Body.tsx | 82 ++++++++++++++ src/components/react/examples/text/Button.tsx | 28 +++++ src/components/react/examples/text/Color.tsx | 20 ++++ .../react/examples/text/Default.tsx | 10 +- .../react/examples/text/Heading.tsx | 38 +++++++ src/components/react/examples/text/Note.tsx | 81 ++++++++++++++ src/components/react/examples/text/Tag.tsx | 28 +++++ .../react/examples/textarea/Disabled.tsx | 8 ++ .../react/examples/textarea/IsInvalid.tsx | 8 ++ .../components/examples/accordion/small.astro | 8 ++ .../action-half-modal/Customized.astro | 8 ++ .../action-half-modal/fullscreen.astro | 8 ++ .../action-half-modal/no-close-button.astro | 8 ++ .../action-half-modal/secondary.astro | 8 ++ .../examples/action-modal/customized.astro | 8 ++ .../examples/action-modal/fixed-height.astro | 8 ++ .../examples/action-modal/secondary.astro | 8 ++ .../components/examples/button/block.astro | 8 ++ .../components/examples/button/disabled.astro | 8 ++ .../components/examples/button/size.astro | 8 ++ .../examples/button/with-icon.astro | 8 ++ .../examples/checkbox/disabled.astro | 8 ++ .../examples/checkbox/single-use.astro | 8 ++ .../components/examples/checkbox/size.astro | 8 ++ .../components/examples/input/disabled.astro | 8 ++ .../examples/input/is-invalid.astro | 8 ++ .../components/examples/input/types.astro | 8 ++ .../examples/link-button/block.astro | 8 ++ .../examples/link-button/disabled.astro | 8 ++ .../examples/link-button/size.astro | 8 ++ .../examples/link-button/with-icon.astro | 8 ++ .../examples/link-card/with-icon.astro | 8 ++ .../examples/message-modal/fixed-height.astro | 8 ++ .../message-modal/overlay-darker.astro | 8 ++ .../examples/message-modal/with-header.astro | 8 ++ .../examples/radio-button/disabled.astro | 8 ++ .../examples/radio-button/size.astro | 8 ++ .../examples/radio-card/block.astro | 8 ++ .../components/examples/select/disabled.astro | 8 ++ .../examples/select/is-invalid.astro | 8 ++ .../block-level-elements-to-full-width.astro | 8 ++ .../examples/stack/centralized.astro | 8 ++ .../examples/stack/markup-as-list.astro | 8 ++ .../components/examples/stack/nested.astro | 8 ++ .../examples/stack/put-on-the-end.astro | 8 ++ .../{horizontal.astro => vertical.astro} | 4 +- src/pages/components/examples/text/body.astro | 8 ++ .../components/examples/text/button.astro | 8 ++ .../components/examples/text/color.astro | 8 ++ .../components/examples/text/heading.astro | 8 ++ src/pages/components/examples/text/note.astro | 8 ++ src/pages/components/examples/text/tag.astro | 8 ++ .../examples/textarea/disabled.astro | 8 ++ .../examples/textarea/is-invalid.astro | 8 ++ src/utils/server/example.ts | 20 +++- 97 files changed, 1750 insertions(+), 46 deletions(-) create mode 100644 src/components/react/examples/accordion/Small.tsx create mode 100644 src/components/react/examples/action-half-modal/Customized.tsx create mode 100644 src/components/react/examples/action-half-modal/Fullscreen.tsx create mode 100644 src/components/react/examples/action-half-modal/NoCloseButton.tsx create mode 100644 src/components/react/examples/action-half-modal/Secondary.tsx create mode 100644 src/components/react/examples/action-modal/Customized.tsx create mode 100644 src/components/react/examples/action-modal/FixedHeight.tsx create mode 100644 src/components/react/examples/action-modal/Secondary.tsx create mode 100644 src/components/react/examples/button/Block.tsx create mode 100644 src/components/react/examples/button/Disabled.tsx create mode 100644 src/components/react/examples/button/Size.tsx create mode 100644 src/components/react/examples/button/WithIcon.tsx create mode 100644 src/components/react/examples/checkbox/Disabled.tsx create mode 100644 src/components/react/examples/checkbox/SingleUse.tsx create mode 100644 src/components/react/examples/checkbox/Size.tsx create mode 100644 src/components/react/examples/input/Disabled.tsx create mode 100644 src/components/react/examples/input/IsInvalid.tsx create mode 100644 src/components/react/examples/input/Types.tsx create mode 100644 src/components/react/examples/link-button/Block.tsx create mode 100644 src/components/react/examples/link-button/Disabled.tsx create mode 100644 src/components/react/examples/link-button/Size.tsx create mode 100644 src/components/react/examples/link-button/WithIcon.tsx create mode 100644 src/components/react/examples/link-card/WithIcon.tsx create mode 100644 src/components/react/examples/message-modal/FixedHeight.tsx create mode 100644 src/components/react/examples/message-modal/OverlayDarker.tsx create mode 100644 src/components/react/examples/message-modal/WithHeader.tsx create mode 100644 src/components/react/examples/radio-button/Disabled.tsx create mode 100644 src/components/react/examples/radio-button/Size.tsx create mode 100644 src/components/react/examples/radio-card/Block.tsx create mode 100644 src/components/react/examples/select/Disabled.tsx create mode 100644 src/components/react/examples/select/IsInvalid.tsx create mode 100644 src/components/react/examples/stack/BlockLevelElementsToFullWidth.tsx create mode 100644 src/components/react/examples/stack/Centralized.tsx create mode 100644 src/components/react/examples/stack/MarkupAsList.tsx create mode 100644 src/components/react/examples/stack/Nested.tsx create mode 100644 src/components/react/examples/stack/PutOnTheEnd.tsx rename src/components/react/examples/stack/{Horizontal.tsx => Vertical.tsx} (100%) create mode 100644 src/components/react/examples/text/Body.tsx create mode 100644 src/components/react/examples/text/Button.tsx create mode 100644 src/components/react/examples/text/Color.tsx create mode 100644 src/components/react/examples/text/Heading.tsx create mode 100644 src/components/react/examples/text/Note.tsx create mode 100644 src/components/react/examples/text/Tag.tsx create mode 100644 src/components/react/examples/textarea/Disabled.tsx create mode 100644 src/components/react/examples/textarea/IsInvalid.tsx create mode 100644 src/pages/components/examples/accordion/small.astro create mode 100644 src/pages/components/examples/action-half-modal/Customized.astro create mode 100644 src/pages/components/examples/action-half-modal/fullscreen.astro create mode 100644 src/pages/components/examples/action-half-modal/no-close-button.astro create mode 100644 src/pages/components/examples/action-half-modal/secondary.astro create mode 100644 src/pages/components/examples/action-modal/customized.astro create mode 100644 src/pages/components/examples/action-modal/fixed-height.astro create mode 100644 src/pages/components/examples/action-modal/secondary.astro create mode 100644 src/pages/components/examples/button/block.astro create mode 100644 src/pages/components/examples/button/disabled.astro create mode 100644 src/pages/components/examples/button/size.astro create mode 100644 src/pages/components/examples/button/with-icon.astro create mode 100644 src/pages/components/examples/checkbox/disabled.astro create mode 100644 src/pages/components/examples/checkbox/single-use.astro create mode 100644 src/pages/components/examples/checkbox/size.astro create mode 100644 src/pages/components/examples/input/disabled.astro create mode 100644 src/pages/components/examples/input/is-invalid.astro create mode 100644 src/pages/components/examples/input/types.astro create mode 100644 src/pages/components/examples/link-button/block.astro create mode 100644 src/pages/components/examples/link-button/disabled.astro create mode 100644 src/pages/components/examples/link-button/size.astro create mode 100644 src/pages/components/examples/link-button/with-icon.astro create mode 100644 src/pages/components/examples/link-card/with-icon.astro create mode 100644 src/pages/components/examples/message-modal/fixed-height.astro create mode 100644 src/pages/components/examples/message-modal/overlay-darker.astro create mode 100644 src/pages/components/examples/message-modal/with-header.astro create mode 100644 src/pages/components/examples/radio-button/disabled.astro create mode 100644 src/pages/components/examples/radio-button/size.astro create mode 100644 src/pages/components/examples/radio-card/block.astro create mode 100644 src/pages/components/examples/select/disabled.astro create mode 100644 src/pages/components/examples/select/is-invalid.astro create mode 100644 src/pages/components/examples/stack/block-level-elements-to-full-width.astro create mode 100644 src/pages/components/examples/stack/centralized.astro create mode 100644 src/pages/components/examples/stack/markup-as-list.astro create mode 100644 src/pages/components/examples/stack/nested.astro create mode 100644 src/pages/components/examples/stack/put-on-the-end.astro rename src/pages/components/examples/stack/{horizontal.astro => vertical.astro} (55%) create mode 100644 src/pages/components/examples/text/body.astro create mode 100644 src/pages/components/examples/text/button.astro create mode 100644 src/pages/components/examples/text/color.astro create mode 100644 src/pages/components/examples/text/heading.astro create mode 100644 src/pages/components/examples/text/note.astro create mode 100644 src/pages/components/examples/text/tag.astro create mode 100644 src/pages/components/examples/textarea/disabled.astro create mode 100644 src/pages/components/examples/textarea/is-invalid.astro diff --git a/src/components/react/examples/accordion/Small.tsx b/src/components/react/examples/accordion/Small.tsx new file mode 100644 index 0000000..f0e8fc4 --- /dev/null +++ b/src/components/react/examples/accordion/Small.tsx @@ -0,0 +1,12 @@ +import { Accordion } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Small: FC = () => { + return ( + + 何は時分どうもどんな観念顔というののところを云ったいまし。とうてい今日に説明院は現にこういう反対たますくらいから思わて来るないにも撲殺なるたたて、始終にも願うただですん。 + + ); +}; + +export default Small; diff --git a/src/components/react/examples/action-half-modal/Customized.tsx b/src/components/react/examples/action-half-modal/Customized.tsx new file mode 100644 index 0000000..1595e41 --- /dev/null +++ b/src/components/react/examples/action-half-modal/Customized.tsx @@ -0,0 +1,33 @@ +import { ActionHalfModal } from '@ubie/ubie-ui'; +import { useCallback, useState } from 'react'; +import type { FC } from 'react'; + +const Customized: FC = () => { + const [open, setOpen] = useState(true); + + const onClose = useCallback(() => { + setOpen(false); + }, []); + + return ( + <> + + + body + + + ); +}; + +export default Customized; diff --git a/src/components/react/examples/action-half-modal/Fullscreen.tsx b/src/components/react/examples/action-half-modal/Fullscreen.tsx new file mode 100644 index 0000000..fa2a513 --- /dev/null +++ b/src/components/react/examples/action-half-modal/Fullscreen.tsx @@ -0,0 +1,24 @@ +import { ActionHalfModal } from '@ubie/ubie-ui'; +import { useCallback, useState } from 'react'; +import type { FC } from 'react'; + +const Fullscreen: FC = () => { + const [open, setOpen] = useState(true); + + const onClose = useCallback(() => { + setOpen(false); + }, []); + + return ( + <> + + + body + + + ); +}; + +export default Fullscreen; diff --git a/src/components/react/examples/action-half-modal/NoCloseButton.tsx b/src/components/react/examples/action-half-modal/NoCloseButton.tsx new file mode 100644 index 0000000..261bcc9 --- /dev/null +++ b/src/components/react/examples/action-half-modal/NoCloseButton.tsx @@ -0,0 +1,31 @@ +import { ActionHalfModal } from '@ubie/ubie-ui'; +import { useCallback, useState } from 'react'; +import type { FC } from 'react'; + +const NoCloseButton: FC = () => { + const [open, setOpen] = useState(true); + + const onClose = useCallback(() => { + setOpen(false); + }, []); + + return ( + <> + + + body + + + ); +}; + +export default NoCloseButton; diff --git a/src/components/react/examples/action-half-modal/Secondary.tsx b/src/components/react/examples/action-half-modal/Secondary.tsx new file mode 100644 index 0000000..7b9f6b6 --- /dev/null +++ b/src/components/react/examples/action-half-modal/Secondary.tsx @@ -0,0 +1,32 @@ +import { ActionHalfModal } from '@ubie/ubie-ui'; +import { useCallback, useState } from 'react'; +import type { FC } from 'react'; + +const Secondary: FC = () => { + const [open, setOpen] = useState(true); + + const onClose = useCallback(() => { + setOpen(false); + }, []); + + return ( + <> + + + body + + + ); +}; + +export default Secondary; diff --git a/src/components/react/examples/action-modal/Customized.tsx b/src/components/react/examples/action-modal/Customized.tsx new file mode 100644 index 0000000..799d516 --- /dev/null +++ b/src/components/react/examples/action-modal/Customized.tsx @@ -0,0 +1,29 @@ +import { ActionModal } from '@ubie/ubie-ui'; +import { useState } from 'react'; +import type { FC } from 'react'; + +const Secondary: FC = () => { + const [open, setOpen] = useState(true); + + return ( + <> + + setOpen(false)} + onClose={() => setOpen(false)} + > + Default + + + ); +}; + +export default Secondary; diff --git a/src/components/react/examples/action-modal/FixedHeight.tsx b/src/components/react/examples/action-modal/FixedHeight.tsx new file mode 100644 index 0000000..39f8d26 --- /dev/null +++ b/src/components/react/examples/action-modal/FixedHeight.tsx @@ -0,0 +1,26 @@ +import { ActionModal } from '@ubie/ubie-ui'; +import { useState } from 'react'; +import type { FC } from 'react'; + +const FixedHeight: FC = () => { + const [open, setOpen] = useState(true); + + return ( + <> + + setOpen(false)} + onClose={() => setOpen(false)} + > +

Default

+
+ + ); +}; + +export default FixedHeight; diff --git a/src/components/react/examples/action-modal/Secondary.tsx b/src/components/react/examples/action-modal/Secondary.tsx new file mode 100644 index 0000000..c9dd779 --- /dev/null +++ b/src/components/react/examples/action-modal/Secondary.tsx @@ -0,0 +1,28 @@ +import { ActionModal } from '@ubie/ubie-ui'; +import { useState } from 'react'; +import type { FC } from 'react'; + +const Secondary: FC = () => { + const [open, setOpen] = useState(true); + + return ( + <> + + setOpen(false)} + secondaryActionLabel={'このまま回答を続ける'} + onSecondaryAction={() => setOpen(false)} + onClose={() => setOpen(false)} + > + Default + + + ); +}; + +export default Secondary; diff --git a/src/components/react/examples/button/Block.tsx b/src/components/react/examples/button/Block.tsx new file mode 100644 index 0000000..200a098 --- /dev/null +++ b/src/components/react/examples/button/Block.tsx @@ -0,0 +1,26 @@ +import { Button } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Block: FC = () => { + return ( +
+
+ +
+
+ +
+
+ +
+
+ ); +}; + +export default Block; diff --git a/src/components/react/examples/button/Default.tsx b/src/components/react/examples/button/Default.tsx index c652b97..66f5dd3 100644 --- a/src/components/react/examples/button/Default.tsx +++ b/src/components/react/examples/button/Default.tsx @@ -2,7 +2,16 @@ import { Button } from '@ubie/ubie-ui'; import type { FC } from 'react'; const Default: FC = () => { - return ; + return ( +
+ + + + + + +
+ ); }; export default Default; diff --git a/src/components/react/examples/button/Disabled.tsx b/src/components/react/examples/button/Disabled.tsx new file mode 100644 index 0000000..df991f3 --- /dev/null +++ b/src/components/react/examples/button/Disabled.tsx @@ -0,0 +1,27 @@ +import { Button } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Disabled: FC = () => { + return ( +
+ + + + + + +
+ ); +}; + +export default Disabled; diff --git a/src/components/react/examples/button/Size.tsx b/src/components/react/examples/button/Size.tsx new file mode 100644 index 0000000..ca6443a --- /dev/null +++ b/src/components/react/examples/button/Size.tsx @@ -0,0 +1,16 @@ +import { Button } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Default: FC = () => { + return ( +
+ + + + + +
+ ); +}; + +export default Default; diff --git a/src/components/react/examples/button/WithIcon.tsx b/src/components/react/examples/button/WithIcon.tsx new file mode 100644 index 0000000..55af145 --- /dev/null +++ b/src/components/react/examples/button/WithIcon.tsx @@ -0,0 +1,89 @@ +import { BlankLinkIcon, UbieIcon, TrashIcon } from '@ubie/ubie-icons'; +import { Button, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Default: FC = () => { + return ( + + +
Default Position
+
+
+ + + + + + +
+
+
+ + +
Position Suffix
+
+
+ + + + + + +
+
+
+ + +
Position Fixed
+
+
+ + + + + + +
+
+
+
+ ); +}; + +export default Default; diff --git a/src/components/react/examples/checkbox/Disabled.tsx b/src/components/react/examples/checkbox/Disabled.tsx new file mode 100644 index 0000000..6383909 --- /dev/null +++ b/src/components/react/examples/checkbox/Disabled.tsx @@ -0,0 +1,18 @@ +import { Checkbox, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Disabled: FC = () => { + return ( + + + Checked + + + + Unchecked + + + ); +}; + +export default Disabled; diff --git a/src/components/react/examples/checkbox/SingleUse.tsx b/src/components/react/examples/checkbox/SingleUse.tsx new file mode 100644 index 0000000..fdb2283 --- /dev/null +++ b/src/components/react/examples/checkbox/SingleUse.tsx @@ -0,0 +1,17 @@ +import { Checkbox } from '@ubie/ubie-ui'; +import { useState, useCallback } from 'react'; +import type { FC, ChangeEventHandler } from 'react'; + +const SingleUse: FC = () => { + const [checked, setChecked] = useState(false); + + const onChange: ChangeEventHandler = useCallback((event) => setChecked(event.target.checked), []); + + return ( + + Enable Option + + ); +}; + +export default SingleUse; diff --git a/src/components/react/examples/checkbox/Size.tsx b/src/components/react/examples/checkbox/Size.tsx new file mode 100644 index 0000000..c748f6d --- /dev/null +++ b/src/components/react/examples/checkbox/Size.tsx @@ -0,0 +1,17 @@ +import { Checkbox, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Size: FC = () => { + return ( + + + Medium + + + Small + + + ); +}; + +export default Size; diff --git a/src/components/react/examples/input/Disabled.tsx b/src/components/react/examples/input/Disabled.tsx new file mode 100644 index 0000000..f8c5758 --- /dev/null +++ b/src/components/react/examples/input/Disabled.tsx @@ -0,0 +1,8 @@ +import { Input } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Disabled: FC = () => { + return ; +}; + +export default Disabled; diff --git a/src/components/react/examples/input/IsInvalid.tsx b/src/components/react/examples/input/IsInvalid.tsx new file mode 100644 index 0000000..f5cc7f1 --- /dev/null +++ b/src/components/react/examples/input/IsInvalid.tsx @@ -0,0 +1,8 @@ +import { Input } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const IsInvalid: FC = () => { + return ; +}; + +export default IsInvalid; diff --git a/src/components/react/examples/input/Types.tsx b/src/components/react/examples/input/Types.tsx new file mode 100644 index 0000000..a52e186 --- /dev/null +++ b/src/components/react/examples/input/Types.tsx @@ -0,0 +1,81 @@ +import { Input, Stack } from '@ubie/ubie-ui'; +import { useState, useCallback } from 'react'; +import type { FC, ChangeEventHandler } from 'react'; + +const Types: FC = () => { + const [textValue, setTextValue] = useState('lorem ipsum'); + const [mailValue, setMailValue] = useState('test@example.com'); + const [passwordValue, setPasswordValue] = useState('abcd1234'); + const [telValue, setTelValue] = useState('000-0000-0000'); + const [urlValue, setUrlValue] = useState('http://www.example.com'); + const [numberValue, setNumberValue] = useState('10'); + + const onChangeText: ChangeEventHandler = useCallback((event) => { + setTextValue(event.target.value); + }, []); + const onChangeMail: ChangeEventHandler = useCallback((event) => { + setMailValue(event.target.value); + }, []); + const onPasswordValue: ChangeEventHandler = useCallback((event) => { + setPasswordValue(event.target.value); + }, []); + const onTelValue: ChangeEventHandler = useCallback((event) => { + setTelValue(event.target.value); + }, []); + const onUrlValue: ChangeEventHandler = useCallback((event) => { + setUrlValue(event.target.value); + }, []); + const onNumberValue: ChangeEventHandler = useCallback((event) => { + setNumberValue(event.target.value); + }, []); + + const labelStyle = { display: 'inline-block', paddingBottom: '8px', fontSize: '13px' }; + + return ( + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ ); +}; + +export default Types; diff --git a/src/components/react/examples/link-button/Block.tsx b/src/components/react/examples/link-button/Block.tsx new file mode 100644 index 0000000..ef043b9 --- /dev/null +++ b/src/components/react/examples/link-button/Block.tsx @@ -0,0 +1,26 @@ +import { LinkButton } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Block: FC = () => { + return ( +
+
+ + ボタン + +
+
+ + ボタン + +
+
+ + ボタン + +
+
+ ); +}; + +export default Block; diff --git a/src/components/react/examples/link-button/Default.tsx b/src/components/react/examples/link-button/Default.tsx index 062f610..5709ef1 100644 --- a/src/components/react/examples/link-button/Default.tsx +++ b/src/components/react/examples/link-button/Default.tsx @@ -2,7 +2,26 @@ import { LinkButton } from '@ubie/ubie-ui'; import type { FC } from 'react'; const Default: FC = () => { - return ボタン; + return ( +
+ ボタン + + ボタン + + + ボタン + + + ボタン + + + ボタン + + + ボタン + +
+ ); }; export default Default; diff --git a/src/components/react/examples/link-button/Disabled.tsx b/src/components/react/examples/link-button/Disabled.tsx new file mode 100644 index 0000000..4fd5752 --- /dev/null +++ b/src/components/react/examples/link-button/Disabled.tsx @@ -0,0 +1,29 @@ +import { LinkButton } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Disabled: FC = () => { + return ( +
+ + ボタン + + + ボタン + + + ボタン + + + ボタン + + + ボタン + + + ボタン + +
+ ); +}; + +export default Disabled; diff --git a/src/components/react/examples/link-button/Size.tsx b/src/components/react/examples/link-button/Size.tsx new file mode 100644 index 0000000..dbcee8b --- /dev/null +++ b/src/components/react/examples/link-button/Size.tsx @@ -0,0 +1,20 @@ +import { LinkButton } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Size: FC = () => { + return ( +
+
+ + Small + + + Medium + + Large +
+
+ ); +}; + +export default Size; diff --git a/src/components/react/examples/link-button/WithIcon.tsx b/src/components/react/examples/link-button/WithIcon.tsx new file mode 100644 index 0000000..20c800c --- /dev/null +++ b/src/components/react/examples/link-button/WithIcon.tsx @@ -0,0 +1,100 @@ +import { UbieIcon, BlankLinkIcon, TrashIcon } from '@ubie/ubie-icons'; +import { LinkButton, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const WithIcon: FC = () => { + return ( + + +
Default Position
+ +
+
+ }> + ボタン + + } variant="secondary"> + ボタン + + } variant="accent"> + ボタン + + } variant="alert"> + ボタン + + } variant="text"> + ボタン + + } variant="textAlert"> + ボタン + +
+
+
+ + +
Position Suffix
+
+
+ }> + ボタン + + } variant="secondary"> + ボタン + + } variant="accent"> + ボタン + + } variant="alert"> + ボタン + + } variant="text"> + ボタン + + } variant="textAlert"> + ボタン + + } variant="textAlert"> + ボタン + +
+
+
+ + +
Position Fixed
+ +
+
+ }> + ボタン + + } variant="secondary"> + ボタン + + } variant="accent"> + ボタン + + } variant="alert"> + ボタン + + } variant="text"> + ボタン + + } variant="textAlert"> + ボタン + +
+
+
+
+ ); +}; + +export default WithIcon; diff --git a/src/components/react/examples/link-card/Default.tsx b/src/components/react/examples/link-card/Default.tsx index 6c5f62a..cc35323 100644 --- a/src/components/react/examples/link-card/Default.tsx +++ b/src/components/react/examples/link-card/Default.tsx @@ -1,24 +1,20 @@ -import { MedicalFormIcon } from '@ubie/ubie-icons'; -import { LinkCard } from '@ubie/ubie-ui'; +import { LinkCard, Stack } from '@ubie/ubie-ui'; import type { FC } from 'react'; const Default: FC = () => { return ( - <> + + -
- -
- +
); }; diff --git a/src/components/react/examples/link-card/WithIcon.tsx b/src/components/react/examples/link-card/WithIcon.tsx new file mode 100644 index 0000000..909a1cd --- /dev/null +++ b/src/components/react/examples/link-card/WithIcon.tsx @@ -0,0 +1,16 @@ +import { MedicalFormIcon } from '@ubie/ubie-icons'; +import { LinkCard } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const WithIcon: FC = () => { + return ( + + ); +}; + +export default WithIcon; diff --git a/src/components/react/examples/message-modal/FixedHeight.tsx b/src/components/react/examples/message-modal/FixedHeight.tsx new file mode 100644 index 0000000..dcdd9fc --- /dev/null +++ b/src/components/react/examples/message-modal/FixedHeight.tsx @@ -0,0 +1,20 @@ +import { MessageModal } from '@ubie/ubie-ui'; +import { useState } from 'react'; +import type { FC } from 'react'; + +const FixedHeight: FC = () => { + const [open, setOpen] = useState(true); + + return ( + <> + + setOpen(false)} fixedHeight> +

Default

+
+ + ); +}; + +export default FixedHeight; diff --git a/src/components/react/examples/message-modal/OverlayDarker.tsx b/src/components/react/examples/message-modal/OverlayDarker.tsx new file mode 100644 index 0000000..e98d632 --- /dev/null +++ b/src/components/react/examples/message-modal/OverlayDarker.tsx @@ -0,0 +1,20 @@ +import { MessageModal } from '@ubie/ubie-ui'; +import { useState } from 'react'; +import type { FC } from 'react'; + +const OverlayDarker: FC = () => { + const [open, setOpen] = useState(true); + + return ( + <> + + setOpen(false)} overlayOpacity="darker"> +

Default

+
+ + ); +}; + +export default OverlayDarker; diff --git a/src/components/react/examples/message-modal/WithHeader.tsx b/src/components/react/examples/message-modal/WithHeader.tsx new file mode 100644 index 0000000..67ca848 --- /dev/null +++ b/src/components/react/examples/message-modal/WithHeader.tsx @@ -0,0 +1,20 @@ +import { MessageModal } from '@ubie/ubie-ui'; +import { useState } from 'react'; +import type { FC } from 'react'; + +const WithHeader: FC = () => { + const [open, setOpen] = useState(true); + + return ( + <> + + setOpen(false)}> +

Default

+
+ + ); +}; + +export default WithHeader; diff --git a/src/components/react/examples/radio-button/Disabled.tsx b/src/components/react/examples/radio-button/Disabled.tsx new file mode 100644 index 0000000..f5e83be --- /dev/null +++ b/src/components/react/examples/radio-button/Disabled.tsx @@ -0,0 +1,39 @@ +import { RadioButton, Stack } from '@ubie/ubie-ui'; +import { useState, useCallback } from 'react'; +import type { FC, ChangeEventHandler } from 'react'; + +const Disabled: FC = () => { + const [selectedItem, setSelectedItem] = useState('checked'); + + const onChange: ChangeEventHandler = useCallback((event) => { + setSelectedItem(event.target.value); + }, []); + + return ( + + + Checked + + + + Unchecked + + + ); +}; + +export default Disabled; diff --git a/src/components/react/examples/radio-button/Size.tsx b/src/components/react/examples/radio-button/Size.tsx new file mode 100644 index 0000000..2280f7c --- /dev/null +++ b/src/components/react/examples/radio-button/Size.tsx @@ -0,0 +1,31 @@ +import { RadioButton, Stack } from '@ubie/ubie-ui'; +import { useState, useCallback } from 'react'; +import type { FC, ChangeEventHandler } from 'react'; + +const Size: FC = () => { + const [selectedItem, setSelectedItem] = useState('medium'); + + const onChange: ChangeEventHandler = useCallback((event) => { + setSelectedItem(event.target.value); + }, []); + + return ( + + + Medium + + + Small + + + ); +}; + +export default Size; diff --git a/src/components/react/examples/radio-card/Block.tsx b/src/components/react/examples/radio-card/Block.tsx new file mode 100644 index 0000000..242f98a --- /dev/null +++ b/src/components/react/examples/radio-card/Block.tsx @@ -0,0 +1,25 @@ +import { RadioCard, Stack } from '@ubie/ubie-ui'; +import { useState, useCallback } from 'react'; +import type { FC, ChangeEventHandler } from 'react'; + +const Block: FC = () => { + const options = ['option1', 'option2', 'option3']; + + const [value, setValue] = useState('option1'); + + const onChange = useCallback>((event) => { + setValue(event.target.value); + }, []); + + return ( + + {options.map((option) => ( + + {option} + + ))} + + ); +}; + +export default Block; diff --git a/src/components/react/examples/radio-card/Default.tsx b/src/components/react/examples/radio-card/Default.tsx index a66dca4..869ef51 100644 --- a/src/components/react/examples/radio-card/Default.tsx +++ b/src/components/react/examples/radio-card/Default.tsx @@ -1,22 +1,36 @@ -import { LinkCard } from '@ubie/ubie-ui'; -import type { FC } from 'react'; +import { RadioCard, Stack } from '@ubie/ubie-ui'; +import { useState, useCallback } from 'react'; +import type { FC, ChangeEventHandler } from 'react'; const Default: FC = () => { + const options = ['option1', 'option2', 'option3']; + + const [selectedItem, setSelectedItem] = useState(options[0]); + + const onChange: ChangeEventHandler = useCallback((event) => { + setSelectedItem(event.target.value); + }, []); + return ( - <> - -
- -
- + + {options.map((option) => ( + + {option} + + ))} + +
+
Values
+
{selectedItem}
+
+
); }; diff --git a/src/components/react/examples/select/Disabled.tsx b/src/components/react/examples/select/Disabled.tsx new file mode 100644 index 0000000..a84b3a4 --- /dev/null +++ b/src/components/react/examples/select/Disabled.tsx @@ -0,0 +1,16 @@ +import { Select } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Disabled: FC = () => { + const options = ['option1', 'option2', 'option3']; + + return ( + + ); +}; + +export default Disabled; diff --git a/src/components/react/examples/select/IsInvalid.tsx b/src/components/react/examples/select/IsInvalid.tsx new file mode 100644 index 0000000..6fb0683 --- /dev/null +++ b/src/components/react/examples/select/IsInvalid.tsx @@ -0,0 +1,16 @@ +import { Select } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const IsInvalid: FC = () => { + const options = ['option1', 'option2', 'option3']; + + return ( + + ); +}; + +export default IsInvalid; diff --git a/src/components/react/examples/stack/BlockLevelElementsToFullWidth.tsx b/src/components/react/examples/stack/BlockLevelElementsToFullWidth.tsx new file mode 100644 index 0000000..f805f81 --- /dev/null +++ b/src/components/react/examples/stack/BlockLevelElementsToFullWidth.tsx @@ -0,0 +1,29 @@ +import { Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const BlockLevelElementsToFullWidth: FC = () => { + return ( + + +

Block Level Element

+

Block Level Element

+

Block Level Element

+

Block Level Element

+
+ + +

+ If you do not use alignItems="normal": +

+ +

Block Level Element

+

Block Level Element

+

Block Level Element

+

Block Level Element

+
+
+
+ ); +}; + +export default BlockLevelElementsToFullWidth; diff --git a/src/components/react/examples/stack/Centralized.tsx b/src/components/react/examples/stack/Centralized.tsx new file mode 100644 index 0000000..4af4555 --- /dev/null +++ b/src/components/react/examples/stack/Centralized.tsx @@ -0,0 +1,24 @@ +import { Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Centralized: FC = () => { + return ( + + + Words +
+ crowded +
+ in + + simply +
+ dummy +
+ text +
+
+ ); +}; + +export default Centralized; diff --git a/src/components/react/examples/stack/Default.tsx b/src/components/react/examples/stack/Default.tsx index 986a57c..e0e823d 100644 --- a/src/components/react/examples/stack/Default.tsx +++ b/src/components/react/examples/stack/Default.tsx @@ -4,10 +4,10 @@ import type { FC } from 'react'; const Default: FC = () => { return ( -
test
-
test
-
test
-
test
+

テスト

+

テスト

+

テスト

+

テスト

); }; diff --git a/src/components/react/examples/stack/MarkupAsList.tsx b/src/components/react/examples/stack/MarkupAsList.tsx new file mode 100644 index 0000000..0014595 --- /dev/null +++ b/src/components/react/examples/stack/MarkupAsList.tsx @@ -0,0 +1,15 @@ +import { Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const MarkupAsList: FC = () => { + return ( + +
  • テスト
  • +
  • テスト
  • +
  • テスト
  • +
  • テスト
  • +
    + ); +}; + +export default MarkupAsList; diff --git a/src/components/react/examples/stack/Nested.tsx b/src/components/react/examples/stack/Nested.tsx new file mode 100644 index 0000000..bccc93c --- /dev/null +++ b/src/components/react/examples/stack/Nested.tsx @@ -0,0 +1,28 @@ +import { Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Nested: FC = () => { + return ( + +

    1

    + + +

    2

    +

    2

    +

    2

    +
    + + +

    2

    +

    2

    + +

    3

    +

    3

    +

    3

    +
    +
    +
    + ); +}; + +export default Nested; diff --git a/src/components/react/examples/stack/PutOnTheEnd.tsx b/src/components/react/examples/stack/PutOnTheEnd.tsx new file mode 100644 index 0000000..8d5c9ef --- /dev/null +++ b/src/components/react/examples/stack/PutOnTheEnd.tsx @@ -0,0 +1,15 @@ +import { Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const PutOnTheEnd: FC = () => { + return ( + +

    テスト

    +

    テスト

    +

    テスト

    +

    テスト

    +
    + ); +}; + +export default PutOnTheEnd; diff --git a/src/components/react/examples/stack/Horizontal.tsx b/src/components/react/examples/stack/Vertical.tsx similarity index 100% rename from src/components/react/examples/stack/Horizontal.tsx rename to src/components/react/examples/stack/Vertical.tsx diff --git a/src/components/react/examples/text/Body.tsx b/src/components/react/examples/text/Body.tsx new file mode 100644 index 0000000..a418d8e --- /dev/null +++ b/src/components/react/examples/text/Body.tsx @@ -0,0 +1,82 @@ +import { Text, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Body: FC = () => { + const bodyText = + '症状検索エンジン「ユビー」は「適切なタイミングでの適切な医療との出会い」の橋渡しによって、みなさんの健康・安全をサポートし、医療についての不安・悩み・苦痛を和らげます。'; + + return ( + +
    +
    Default Leading
    +
    + + + sm +
    + {`${bodyText}`} +
    + + md +
    + {`${bodyText}`} +
    + + lg +
    + {`${bodyText}`} +
    +
    +
    +
    + +
    +
    Narrow Leading
    +
    + + + sm +
    + {`${bodyText}`} +
    + + md +
    + {`${bodyText}`} +
    + + lg +
    + {`${bodyText}`} +
    +
    +
    +
    + +
    +
    Tight Leading
    +
    + + + sm +
    + {`${bodyText}`} +
    + + md +
    + {`${bodyText}`} +
    + + lg +
    + {`${bodyText}`} +
    +
    +
    +
    +
    + ); +}; + +export default Body; diff --git a/src/components/react/examples/text/Button.tsx b/src/components/react/examples/text/Button.tsx new file mode 100644 index 0000000..89d939d --- /dev/null +++ b/src/components/react/examples/text/Button.tsx @@ -0,0 +1,28 @@ +import { Text, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Button: FC = () => { + const buttonText = '同意して症状から調べる'; + + return ( + + + sm +
    + {`${buttonText}`} +
    + + md +
    + {`${buttonText}`} +
    + + lg +
    + {`${buttonText}`} +
    +
    + ); +}; + +export default Button; diff --git a/src/components/react/examples/text/Color.tsx b/src/components/react/examples/text/Color.tsx new file mode 100644 index 0000000..3494b06 --- /dev/null +++ b/src/components/react/examples/text/Color.tsx @@ -0,0 +1,20 @@ +import { Text, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Color: FC = () => ( + + main + sub + link + linkSub + disabled + primary + accent + alert + + white + + +); + +export default Color; diff --git a/src/components/react/examples/text/Default.tsx b/src/components/react/examples/text/Default.tsx index 855f012..fdd2cf7 100644 --- a/src/components/react/examples/text/Default.tsx +++ b/src/components/react/examples/text/Default.tsx @@ -3,13 +3,9 @@ import type { FC } from 'react'; const Default: FC = () => { return ( - <> - - 私の青春時代 - - 私が中学生に上がったすぐの頃、それはもう緊張した面持ちで…… - 彼は踵を返すと一目散に校庭を通り…… - + + Dummy Text + ); }; diff --git a/src/components/react/examples/text/Heading.tsx b/src/components/react/examples/text/Heading.tsx new file mode 100644 index 0000000..4f56ecb --- /dev/null +++ b/src/components/react/examples/text/Heading.tsx @@ -0,0 +1,38 @@ +import { Text, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Heading: FC = () => { + const headingText = '近くの医療機関から調べる'; + + return ( + + + xs +
    + {`${headingText}`} +
    + + sm +
    + {`${headingText}`} +
    + + md +
    + {`${headingText}`} +
    + + lg +
    + {`${headingText}`} +
    + + xl +
    + {`${headingText}`} +
    +
    + ); +}; + +export default Heading; diff --git a/src/components/react/examples/text/Note.tsx b/src/components/react/examples/text/Note.tsx new file mode 100644 index 0000000..3ca12ea --- /dev/null +++ b/src/components/react/examples/text/Note.tsx @@ -0,0 +1,81 @@ +import { Text, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Note: FC = () => { + const noteText = + '症状検索エンジン「ユビー」は「適切なタイミングでの適切な医療との出会い」の橋渡しによって、みなさんの健康・安全をサポートし、医療についての不安・悩み・苦痛を和らげます。'; + + return ( + +
    +
    Default Leading
    +
    + + + sm +
    + {`${noteText}`} +
    + + md +
    + {`${noteText}`} +
    + + lg +
    + {`${noteText}`} +
    +
    +
    +
    + +
    +
    Narrow Leading
    +
    + + + sm +
    + {`${noteText}`} +
    + + md +
    + {`${noteText}`} +
    + + lg +
    + {`${noteText}`} +
    +
    +
    +
    +
    +
    Tight Leading
    +
    + + + sm +
    + {`${noteText}`} +
    + + md +
    + {`${noteText}`} +
    + + lg +
    + {`${noteText}`} +
    +
    +
    +
    +
    + ); +}; + +export default Note; diff --git a/src/components/react/examples/text/Tag.tsx b/src/components/react/examples/text/Tag.tsx new file mode 100644 index 0000000..cad0528 --- /dev/null +++ b/src/components/react/examples/text/Tag.tsx @@ -0,0 +1,28 @@ +import { Text, Stack } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Tag: FC = () => { + const tagText = '循環器内科'; + + return ( + + + sm +
    + {`${tagText}`} +
    + + md +
    + {`${tagText}`} +
    + + lg +
    + {`${tagText}`} +
    +
    + ); +}; + +export default Tag; diff --git a/src/components/react/examples/textarea/Disabled.tsx b/src/components/react/examples/textarea/Disabled.tsx new file mode 100644 index 0000000..db7e672 --- /dev/null +++ b/src/components/react/examples/textarea/Disabled.tsx @@ -0,0 +1,8 @@ +import { TextArea } from '@ubie/ubie-ui'; +import type { FC } from 'react'; + +const Disabled: FC = () => { + return