-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Added ItemAccordion component to ui #277
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
04d2618
init item accordion component
jpaladin 4338446
fixed props
jpaladin d38e9ca
comments
jpaladin d51e065
cleanup
jpaladin 14b0a4c
updated and used changelog categories
jpaladin 6abf7e2
using border color from mui theme divider
jpaladin 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 hidden or 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,26 @@ | ||
| import { ItemAccordion, ItemAccordionDetails, ItemAccordionSummary, ItemAccordionActions } from '@enterwell/react-ui'; | ||
| import { Button, Stack, Typography } from '@mui/material'; | ||
|
|
||
| export function ExampleItemAccordion() { | ||
| return ( | ||
| <ItemAccordion> | ||
| <ItemAccordionSummary> | ||
| <Stack width="160px"> | ||
| <Typography fontSize={14} fontWeight="bold"> | ||
| Test title | ||
| </Typography> | ||
| </Stack> | ||
| <Stack> | ||
| <Typography>Test summary text</Typography> | ||
| </Stack> | ||
| </ItemAccordionSummary> | ||
| <ItemAccordionDetails></ItemAccordionDetails> | ||
| <ItemAccordionActions> | ||
| <Stack direction={'row'}> | ||
| <Button color='warning'>Delete</Button> | ||
| <Button color='success'>Update</Button> | ||
| </Stack> | ||
| </ItemAccordionActions> | ||
| </ItemAccordion> | ||
| ) | ||
| } |
This file contains hidden or 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,33 @@ | ||
| --- | ||
| title: ItemAccordion | ||
| --- | ||
|
|
||
| import { ItemAccordion } from '@enterwell/react-ui'; | ||
| import { ComponentWithSource } from '../../../components/docs/ComponentWithSource.tsx'; | ||
| import { ExampleItemAccordion } from '../../../components/ExampleItemAccordion.tsx'; | ||
| import { ComponentDescription, ComponentParameters, ComponentSource } from '../../../components/docs/ComponentDocs'; | ||
|
|
||
| # ItemAccordion | ||
|
|
||
| ## Description | ||
|
|
||
| <ComponentDescription name="ItemAccordion" /> | ||
|
|
||
| ### Parameters | ||
|
|
||
| <ComponentParameters name="ItemAccordion" /> | ||
|
|
||
| ## Example | ||
|
|
||
| <ComponentWithSource component={ ExampleItemAccordion } centered /> | ||
|
|
||
| ## Inspect | ||
|
|
||
| <details> | ||
| <summary>Source code</summary> | ||
| <ComponentSource | ||
| package="@enterwell/react-ui" | ||
| directory="ItemAccordion" | ||
| name="ItemAccordion" | ||
| /> | ||
| </details> |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| "SearchHeader", | ||
| "Select", | ||
| "SplitButton", | ||
| "TimeInput" | ||
| "TimeInput", | ||
| "ItemAccordion" | ||
| ] | ||
| } | ||
This file contains hidden or 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 MuiAccordion, { type AccordionProps } from '@mui/material/Accordion'; | ||
|
|
||
| /** | ||
| * Item accordion component. | ||
| * | ||
| * @param props - The props of the component | ||
| * @returns The ItemAccordion component. | ||
| * @public | ||
| */ | ||
| export function ItemAccordion(props: AccordionProps) { | ||
| return <MuiAccordion disableGutters {...props} /> | ||
| } |
This file contains hidden or 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,18 @@ | ||
| import { useTheme } from '@mui/material'; | ||
| import MuiAccordionActions, { type AccordionActionsProps } from '@mui/material/AccordionActions'; | ||
|
|
||
| /** | ||
| * Item accordion actions component. | ||
| * | ||
| * @param props - The props of the component | ||
| * @returns The ItemAccordionActions component. | ||
| * @public | ||
| */ | ||
| export function ItemAccordionActions(props: AccordionActionsProps) { | ||
| const theme = useTheme(); | ||
| return ( | ||
| <MuiAccordionActions {...props} sx={{ borderTop: '1px solid', borderTopColor: theme.palette.divider, ...props.sx }} /> | ||
| ); | ||
| } | ||
|
|
||
| export default ItemAccordionActions; |
This file contains hidden or 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,18 @@ | ||
| import { useTheme } from '@mui/material'; | ||
| import MuiAccordionDetails, { type AccordionDetailsProps } from '@mui/material/AccordionDetails'; | ||
|
|
||
| /** | ||
| * Item accordion details component. | ||
| * | ||
| * @param props - The props of the component | ||
| * @returns The ItemAccordionDetails component. | ||
| * @public | ||
| */ | ||
| export function ItemAccordionDetails(props: AccordionDetailsProps) { | ||
| const theme = useTheme(); | ||
| return ( | ||
| <MuiAccordionDetails {...props} sx={{ padding: 16, borderTop: '1px solid', borderTopColor: theme.palette.divider, ...props.sx }} /> | ||
| ); | ||
| } | ||
|
|
||
| export default ItemAccordionDetails; |
This file contains hidden or 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,28 @@ | ||
| import MuiAccordionSummary, { type AccordionSummaryProps } from '@mui/material/AccordionSummary'; | ||
| import { ExpandMore } from '@mui/icons-material'; | ||
|
|
||
| /** | ||
| * Item accordion summary component. | ||
| * | ||
| * @param props - The props of the component | ||
| * @returns The ItemAccordionSummary component. | ||
| * @public | ||
| */ | ||
| export function ItemAccordionSummary(props: AccordionSummaryProps) { | ||
| const { | ||
| children, | ||
| ...rest | ||
| } = props; | ||
|
|
||
| return ( | ||
| <MuiAccordionSummary | ||
| expandIcon={<ExpandMore color="primary" />} | ||
| {...rest} | ||
| sx={{ height: 56, ...rest.sx }} | ||
| > | ||
| {children} | ||
| </MuiAccordionSummary > | ||
| ); | ||
| } | ||
|
|
||
| export default ItemAccordionSummary; | ||
This file contains hidden or 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,4 @@ | ||
| export * from "./ItemAccordion"; | ||
| export * from "./ItemAccordionSummary"; | ||
| export * from "./ItemAccordionDetails"; | ||
| export * from "./ItemAccordionActions"; |
Empty file.
This file contains hidden or 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 hidden or 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
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.
Do we care about the case when
sxis something that cannot be spread?