-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Chenwei Zhang <40295569+zchenwei@users.noreply.github.com>
- Loading branch information
1 parent
3cc1c15
commit 2b2ae84
Showing
17 changed files
with
270 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@aws-amplify/ui-react": patch | ||
"@aws-amplify/ui": patch | ||
--- | ||
|
||
* Divider component has more theming options for the border style, color, and width. | ||
* Fixing vertical divider | ||
* Improving Divider docs |
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
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,51 @@ | ||
import * as React from 'react'; | ||
import { DividerOptions, Flex, SelectField } from '@aws-amplify/ui-react'; | ||
|
||
export interface DividerPropControlsProps extends DividerOptions { | ||
setSize: (value: React.SetStateAction<DividerOptions['size']>) => void; | ||
setOrientation: ( | ||
value: React.SetStateAction<DividerOptions['orientation']> | ||
) => void; | ||
} | ||
|
||
interface DividerPropControlsInterface { | ||
(props: DividerPropControlsProps): JSX.Element; | ||
} | ||
|
||
export const DividerPropControls: DividerPropControlsInterface = ({ | ||
size, | ||
setSize, | ||
orientation, | ||
setOrientation, | ||
}) => { | ||
return ( | ||
<Flex direction="column"> | ||
<SelectField | ||
name="size" | ||
id="size" | ||
label="Size" | ||
value={size} | ||
onChange={(event) => | ||
setSize(event.target.value as DividerOptions['size']) | ||
} | ||
> | ||
<option value="">default</option> | ||
<option value="small">small</option> | ||
<option value="large">large</option> | ||
</SelectField> | ||
|
||
<SelectField | ||
name="orientation" | ||
id="orientation" | ||
label="Orientation" | ||
value={orientation} | ||
onChange={(event) => | ||
setOrientation(event.target.value as DividerOptions['orientation']) | ||
} | ||
> | ||
<option value="horizontal">horizontal</option> | ||
<option value="vertical">vertical</option> | ||
</SelectField> | ||
</Flex> | ||
); | ||
}; |
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
9 changes: 9 additions & 0 deletions
9
docs/src/pages/components/divider/examples/DefaultDividerExample.tsx
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,9 @@ | ||
import { Flex, Text, Divider } from '@aws-amplify/ui-react'; | ||
|
||
export const DefaultDividerExample = () => ( | ||
<Flex direction="column"> | ||
<Text>Before</Text> | ||
<Divider /> | ||
<Text>After</Text> | ||
</Flex> | ||
); |
12 changes: 12 additions & 0 deletions
12
docs/src/pages/components/divider/examples/DividerClassNameExample.tsx
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,12 @@ | ||
import { Flex, Divider } from '@aws-amplify/ui-react'; | ||
|
||
const css = `.custom-divider { | ||
border-style: dashed; | ||
}`; | ||
|
||
export const DividerClassNameExample = () => ( | ||
<Flex direction="column"> | ||
<style>{css}</style> | ||
<Divider className="custom-divider" /> | ||
</Flex> | ||
); |
9 changes: 9 additions & 0 deletions
9
docs/src/pages/components/divider/examples/DividerSizesExample.tsx
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,9 @@ | ||
import { Flex, Divider } from '@aws-amplify/ui-react'; | ||
|
||
export const DividerSizesExample = () => ( | ||
<Flex direction="column"> | ||
<Divider size="small" /> | ||
<Divider /> | ||
<Divider size="large" /> | ||
</Flex> | ||
); |
13 changes: 13 additions & 0 deletions
13
docs/src/pages/components/divider/examples/DividerStylePropsExample.tsx
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,13 @@ | ||
import { Flex, Divider, useTheme } from '@aws-amplify/ui-react'; | ||
|
||
export const DividerStylePropsExample = () => { | ||
const { tokens } = useTheme(); | ||
return ( | ||
<Flex direction="column"> | ||
<Divider | ||
border={`${tokens.borderWidths.large} solid ${tokens.colors.brand.primary[80]}`} | ||
/> | ||
<Divider border="5px solid pink" borderRadius="10px" /> | ||
</Flex> | ||
); | ||
}; |
29 changes: 29 additions & 0 deletions
29
docs/src/pages/components/divider/examples/DividerThemeExample.tsx
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,29 @@ | ||
import { Flex, Text, Divider, AmplifyProvider } from '@aws-amplify/ui-react'; | ||
|
||
const theme = { | ||
name: 'divider-theme', | ||
tokens: { | ||
borderWidths: { | ||
// This will affect the large divider and other components that reference this | ||
large: { value: '20px' }, | ||
}, | ||
components: { | ||
divider: { | ||
borderStyle: { value: 'dotted' }, | ||
// You can reference other theme tokens: | ||
borderColor: { value: '{colors.brand.secondary.80.value}' }, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const DividerThemeExample = () => ( | ||
<AmplifyProvider theme={theme}> | ||
<Flex direction="column"> | ||
<Text>Before</Text> | ||
<Divider /> | ||
<Text>After</Text> | ||
<Divider size="large" /> | ||
</Flex> | ||
</AmplifyProvider> | ||
); |
9 changes: 9 additions & 0 deletions
9
docs/src/pages/components/divider/examples/HorizontalDividerExample.tsx
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,9 @@ | ||
import { Flex, Text, Divider } from '@aws-amplify/ui-react'; | ||
|
||
export const HorizontalDividerExample = () => ( | ||
<Flex direction="column"> | ||
<Text>Before</Text> | ||
<Divider orientation="horizontal" /> | ||
<Text>After</Text> | ||
</Flex> | ||
); |
9 changes: 9 additions & 0 deletions
9
docs/src/pages/components/divider/examples/VerticalDividerExample.tsx
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,9 @@ | ||
import { Flex, Text, Divider } from '@aws-amplify/ui-react'; | ||
|
||
export const VerticalDividerExample = () => ( | ||
<Flex direction="row" justifyContent="space-around"> | ||
<Text>Before</Text> | ||
<Divider orientation="vertical" /> | ||
<Text>After</Text> | ||
</Flex> | ||
); |
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,7 @@ | ||
export { HorizontalDividerExample } from './HorizontalDividerExample'; | ||
export { VerticalDividerExample } from './VerticalDividerExample'; | ||
export { DividerSizesExample } from './DividerSizesExample'; | ||
export { DividerStylePropsExample } from './DividerStylePropsExample'; | ||
export { DividerClassNameExample } from './DividerClassNameExample'; | ||
export { DefaultDividerExample } from './DefaultDividerExample'; | ||
export { DividerThemeExample } from './DividerThemeExample'; |
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.