-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Divider fixes and docs #727
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c9cf9b4
Divider fixes and docs
dbanksdesign 56afacb
Update docs/src/pages/components/divider/DividerPropControls.tsx
dbanksdesign 7dbb53a
Update docs/src/components/useGridContainerProps.tsx
dbanksdesign 7d5e71f
Cleanup based on feedback
dbanksdesign 460834d
Create purple-chefs-jump.md
dbanksdesign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}' }, | ||
}, | ||
}, | ||
}, | ||
}; | ||
Comment on lines
+3
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
||
|
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a line break