-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from Enterwell/feature/item-accordion
feat: Added ItemAccordion component to ui
- Loading branch information
Showing
11 changed files
with
158 additions
and
1 deletion.
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,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 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 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 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 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 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 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 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 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