From a787311029e6c0c179b552f5abdad1dbed73436a Mon Sep 17 00:00:00 2001 From: Heather Buchel Date: Wed, 30 Aug 2023 10:42:33 -0400 Subject: [PATCH] chore(docs): enable theme/react src links and theme examples (#4388) * Update Message/Input links * cleanup, enable links --------- Co-authored-by: Heather Buchel --- .../components/dropzone/index.page.mdx | 5 +- .../[platform]/components/dropzone/react.mdx | 23 ++-- ...meExample.tsx => FieldsetThemeExample.tsx} | 2 +- .../examples/TestFieldsetControls.tsx | 126 ------------------ .../components/fieldset/examples/index.ts | 3 +- .../components/fieldset/index.page.mdx | 3 +- .../[platform]/components/fieldset/react.mdx | 28 ++-- .../components/input/index.page.mdx | 2 +- .../[platform]/components/input/react.mdx | 4 +- .../components/message/index.page.mdx | 4 +- .../[platform]/components/message/react.mdx | 16 ++- 11 files changed, 43 insertions(+), 173 deletions(-) rename docs/src/pages/[platform]/components/fieldset/examples/{ThemeExample.tsx => FieldsetThemeExample.tsx} (94%) delete mode 100644 docs/src/pages/[platform]/components/fieldset/examples/TestFieldsetControls.tsx diff --git a/docs/src/pages/[platform]/components/dropzone/index.page.mdx b/docs/src/pages/[platform]/components/dropzone/index.page.mdx index 4fc6ba93365..2280f4a0893 100644 --- a/docs/src/pages/[platform]/components/dropzone/index.page.mdx +++ b/docs/src/pages/[platform]/components/dropzone/index.page.mdx @@ -1,9 +1,8 @@ --- title: DropZone description: The Dropzone component captures files from user with drag and drop - -# themeSource: packages/ui/src/theme/tokens/components/dropZone.ts -# reactSource: packages/react/src/primitives/DropZone/DropZone.tsx +themeSource: packages/ui/src/theme/tokens/components/dropZone.ts +reactSource: packages/react/src/primitives/DropZone/DropZone.tsx htmlElement: div supportedFrameworks: react --- diff --git a/docs/src/pages/[platform]/components/dropzone/react.mdx b/docs/src/pages/[platform]/components/dropzone/react.mdx index b2da4e3c703..a1bc2299a36 100644 --- a/docs/src/pages/[platform]/components/dropzone/react.mdx +++ b/docs/src/pages/[platform]/components/dropzone/react.mdx @@ -1,6 +1,6 @@ import { Example, ExampleCode } from '@/components/Example' import { ComponentStyleDisplay } from '@/components/ComponentStyleDisplay' - +import ThemeExample from '@/components/ThemeExample.mdx'; import { AcceptRejectDropZoneExample, DefaultDropZoneExample, @@ -71,17 +71,16 @@ You can add a button to open the file picker by adding a hidden input and firing ## Styling -{/* Commenting this out to not break link checker */} -{/* */} - - - - - ```jsx file=./examples/DropZoneThemeExample.tsx - ``` - - -{/* */} + + + + + + ```jsx file=./examples/DropZoneThemeExample.tsx + ``` + + + ### Target classes diff --git a/docs/src/pages/[platform]/components/fieldset/examples/ThemeExample.tsx b/docs/src/pages/[platform]/components/fieldset/examples/FieldsetThemeExample.tsx similarity index 94% rename from docs/src/pages/[platform]/components/fieldset/examples/ThemeExample.tsx rename to docs/src/pages/[platform]/components/fieldset/examples/FieldsetThemeExample.tsx index cea15224e59..b80ffe8cffc 100644 --- a/docs/src/pages/[platform]/components/fieldset/examples/ThemeExample.tsx +++ b/docs/src/pages/[platform]/components/fieldset/examples/FieldsetThemeExample.tsx @@ -21,7 +21,7 @@ const theme = createTheme({ }, }); -export const ThemeExample = () => ( +export const FieldsetThemeExample = () => (
Some content of the fieldset. diff --git a/docs/src/pages/[platform]/components/fieldset/examples/TestFieldsetControls.tsx b/docs/src/pages/[platform]/components/fieldset/examples/TestFieldsetControls.tsx deleted file mode 100644 index b99c58d6dc0..00000000000 --- a/docs/src/pages/[platform]/components/fieldset/examples/TestFieldsetControls.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import { - Autocomplete, - Button, - CheckboxField, - PasswordField, - PhoneNumberField, - Radio, - RadioGroupField, - SearchField, - SelectField, - SliderField, - StepperField, - SwitchField, - TextAreaField, - TextField, - ToggleButton, - Flex, - Fieldset, -} from '@aws-amplify/ui-react'; - -export const TestFieldsetControls = () => { - return ( -
- -
- - -
-
- -
- - - - - - - - - - - - - - Press me! - - - HTML - CSS - JavaScript - - - -
-
-
-
- ); -}; diff --git a/docs/src/pages/[platform]/components/fieldset/examples/index.ts b/docs/src/pages/[platform]/components/fieldset/examples/index.ts index 622c9077065..0153be1cfd0 100644 --- a/docs/src/pages/[platform]/components/fieldset/examples/index.ts +++ b/docs/src/pages/[platform]/components/fieldset/examples/index.ts @@ -5,6 +5,5 @@ export { FieldsetDirection } from './FieldsetDirection'; export { DisabledFieldset } from './DisabledFieldset'; export { FormAttribute } from './FormAttribute'; export { NameAttribute } from './NameAttribute'; -export { ThemeExample } from './ThemeExample'; +export { FieldsetThemeExample } from './FieldsetThemeExample'; export { FieldsetStylePropsExample } from './FieldsetStylePropsExample'; -export { TestFieldsetControls } from './TestFieldsetControls'; diff --git a/docs/src/pages/[platform]/components/fieldset/index.page.mdx b/docs/src/pages/[platform]/components/fieldset/index.page.mdx index 4e5847006bf..612c99b1992 100644 --- a/docs/src/pages/[platform]/components/fieldset/index.page.mdx +++ b/docs/src/pages/[platform]/components/fieldset/index.page.mdx @@ -1,7 +1,8 @@ --- title: Fieldset description: Fieldsets are used to group related form fields. -# reactSource: packages/react/src/primitives/Fieldset/Fieldset.tsx +reactSource: packages/react/src/primitives/Fieldset/Fieldset.tsx +themeSource: packages/ui/src/theme/tokens/components/fieldset.ts mdnUrl: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset htmlElement: fieldset supportedFrameworks: react diff --git a/docs/src/pages/[platform]/components/fieldset/react.mdx b/docs/src/pages/[platform]/components/fieldset/react.mdx index ea461e2f5ab..c7a943b3111 100644 --- a/docs/src/pages/[platform]/components/fieldset/react.mdx +++ b/docs/src/pages/[platform]/components/fieldset/react.mdx @@ -3,6 +3,7 @@ import { Flex, Text, Button, View, Alert, Fieldset, Link } from '@aws-amplify/ui import { FieldsetDemo } from './demo'; import { Example, ExampleCode } from '@/components/Example'; import { ComponentStyleDisplay } from '@/components/ComponentStyleDisplay'; +import ThemeExample from '@/components/ThemeExample.mdx'; import { BasicFieldset, FieldsetSizes, @@ -11,7 +12,7 @@ import { DisabledFieldset, FormAttribute, NameAttribute, - ThemeExample, + FieldsetThemeExample, FieldsetStylePropsExample } from './examples'; @@ -136,22 +137,19 @@ Fieldset supports the [name] attribute. Use the `name` prop to supply a name for ## Styling -### Theme + + + + + - - - - - - - -```jsx file=./examples/ThemeExample.tsx + ```tsx file=./examples/FieldsetThemeExample.tsx -``` - - - + ``` + + + ### Target classes @@ -192,8 +190,6 @@ To override styling on a specific Fieldset, you can use (in order of increasing
This is a purple fieldset
- - ```css diff --git a/docs/src/pages/[platform]/components/input/index.page.mdx b/docs/src/pages/[platform]/components/input/index.page.mdx index 0d308fce42e..572dce89633 100644 --- a/docs/src/pages/[platform]/components/input/index.page.mdx +++ b/docs/src/pages/[platform]/components/input/index.page.mdx @@ -1,7 +1,7 @@ --- title: Input description: Input allows users to enter text content. -# themeSource: packages/ui/src/theme/tokens/components/input.ts +themeSource: packages/ui/src/theme/tokens/components/input.ts reactSource: packages/react/src/primitives/Input/Input.tsx mdnUrl: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input htmlElement: input diff --git a/docs/src/pages/[platform]/components/input/react.mdx b/docs/src/pages/[platform]/components/input/react.mdx index 046941bc5eb..320a0926890 100644 --- a/docs/src/pages/[platform]/components/input/react.mdx +++ b/docs/src/pages/[platform]/components/input/react.mdx @@ -178,7 +178,7 @@ Input primitive comes styled for text input only (type `text`, `date`, `number`, ## Styling -{/* + @@ -190,7 +190,7 @@ Input primitive comes styled for text input only (type `text`, `date`, `number`, - */} + ### Global styling diff --git a/docs/src/pages/[platform]/components/message/index.page.mdx b/docs/src/pages/[platform]/components/message/index.page.mdx index 02f01be08e4..bd75804cad0 100644 --- a/docs/src/pages/[platform]/components/message/index.page.mdx +++ b/docs/src/pages/[platform]/components/message/index.page.mdx @@ -1,8 +1,8 @@ --- title: Message description: A Message can be used to display feedback to the user. -# themeSource: packages/ui/src/theme/tokens/components/message.ts -# reactSource: packages/react/src/primitives/Message/Message.tsx +themeSource: packages/ui/src/theme/tokens/components/message.ts +reactSource: packages/react/src/primitives/Message/Message.tsx mdnUrl: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div htmlElement: div supportedFrameworks: react diff --git a/docs/src/pages/[platform]/components/message/react.mdx b/docs/src/pages/[platform]/components/message/react.mdx index 70b9ddbef38..8cfcf440ff8 100644 --- a/docs/src/pages/[platform]/components/message/react.mdx +++ b/docs/src/pages/[platform]/components/message/react.mdx @@ -93,17 +93,19 @@ For more control over the appearance and functionality of the dismiss button, co ## Styling -### Theme + + + + + - - - - ```jsx file=./examples/MessageThemeExample.tsx + ```tsx file=./examples/MessageThemeExample.tsx ``` - - + + + ### Target classes