-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style MUI
Card
system according to Comet DXP design (#2890)
- Loading branch information
1 parent
f9bd7ad
commit ee59753
Showing
5 changed files
with
154 additions
and
0 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,5 @@ | ||
--- | ||
"@comet/admin-theme": minor | ||
--- | ||
|
||
Add styling of `Card` and `CardHeader` to align with Comet DXP design |
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,19 @@ | ||
import { paperClasses } from "@mui/material"; | ||
|
||
import { mergeOverrideStyles } from "../utils/mergeOverrideStyles"; | ||
import { GetMuiComponentTheme } from "./getComponentsTheme"; | ||
|
||
export const getMuiCard: GetMuiComponentTheme<"MuiCard"> = (component, { spacing }) => ({ | ||
...component, | ||
defaultProps: { | ||
square: false, | ||
...component?.defaultProps, | ||
}, | ||
styleOverrides: mergeOverrideStyles<"MuiCard">(component?.styleOverrides, { | ||
root: { | ||
[`&.${paperClasses.rounded}`]: { | ||
borderRadius: "4px", | ||
}, | ||
}, | ||
}), | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/admin/admin-theme/src/componentsTheme/MuiCardHeader.ts
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 { mergeOverrideStyles } from "../utils/mergeOverrideStyles"; | ||
import { GetMuiComponentTheme } from "./getComponentsTheme"; | ||
|
||
export const getMuiCardHeader: GetMuiComponentTheme<"MuiCardHeader"> = (component, { spacing, palette }) => ({ | ||
...component, | ||
styleOverrides: mergeOverrideStyles<"MuiCardHeader">(component?.styleOverrides, { | ||
root: { | ||
backgroundColor: palette.grey["A200"], | ||
color: "#fff", | ||
paddingBottom: "20px", | ||
paddingTop: "20px", | ||
}, | ||
action: { | ||
lineHeight: 0, | ||
marginBottom: 0, | ||
marginTop: 0, | ||
alignSelf: "center", | ||
|
||
"& > .MuiButton-root": { | ||
marginTop: "-10px", | ||
marginBottom: "-10px", | ||
}, | ||
"& > .MuiIconButton-root": { | ||
marginTop: "-10px", | ||
marginBottom: "-10px", | ||
}, | ||
}, | ||
}), | ||
}); |
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,97 @@ | ||
import { ArrowRight, Reload } from "@comet/admin-icons"; | ||
import { Button, Card, CardContent, CardHeader, Grid, IconButton, Typography } from "@mui/material"; | ||
import * as React from "react"; | ||
|
||
export default { | ||
title: "@comet/admin/mui", | ||
}; | ||
|
||
export const _Card = () => { | ||
return ( | ||
<Grid container spacing={10}> | ||
<Grid item xs={5}> | ||
<Card> | ||
<CardHeader title={<Typography>Card Header</Typography>} /> | ||
<CardContent> | ||
CardContent: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd | ||
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, | ||
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et | ||
justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
<Grid item xs={5}> | ||
<Card> | ||
<CardHeader title={<Typography>Card Header with Avatar (Icon)</Typography>} avatar={<Reload />} /> | ||
<CardContent> | ||
CardContent: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd | ||
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, | ||
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et | ||
justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
<Grid item xs={5}> | ||
<Card> | ||
<CardHeader | ||
title={<Typography>Card Header with Action (Button)</Typography>} | ||
action={ | ||
<Button variant="text" color="inherit" endIcon={<ArrowRight />}> | ||
Show All | ||
</Button> | ||
} | ||
/> | ||
<CardContent> | ||
CardContent: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd | ||
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, | ||
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et | ||
justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
<Grid item xs={5}> | ||
<Card> | ||
<CardHeader | ||
title={<Typography>Card Header with Avatar (Icon) and Action (Button)</Typography>} | ||
avatar={<Reload />} | ||
action={ | ||
<Button variant="text" color="inherit" endIcon={<ArrowRight />}> | ||
Show All | ||
</Button> | ||
} | ||
/> | ||
<CardContent> | ||
CardContent: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd | ||
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, | ||
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et | ||
justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.{" "} | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
<Grid item xs={5}> | ||
<Card> | ||
<CardHeader | ||
title={<Typography>Card Header with IconButton</Typography>} | ||
avatar={<Reload />} | ||
action={ | ||
<IconButton color="inherit" size="large"> | ||
<ArrowRight /> | ||
</IconButton> | ||
} | ||
/> | ||
<CardContent> | ||
CardContent: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd | ||
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, | ||
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et | ||
justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.{" "} | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; |