-
Notifications
You must be signed in to change notification settings - Fork 8
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
Style MuiCard
system
#2890
Open
juliawegmayr
wants to merge
3
commits into
main
Choose a base branch
from
style-mui-card-system
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Style MuiCard
system
#2890
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,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,11 @@ | ||
import { mergeOverrideStyles } from "../utils/mergeOverrideStyles"; | ||
import { GetMuiComponentTheme } from "./getComponentsTheme"; | ||
|
||
export const getMuiCard: GetMuiComponentTheme<"MuiCard"> = (component, { spacing }) => ({ | ||
...component, | ||
styleOverrides: mergeOverrideStyles<"MuiCard">(component?.styleOverrides, { | ||
root: { | ||
borderRadius: "4px", | ||
}, | ||
}), | ||
}); |
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
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", | ||
|
||
"& .MuiButtonBase-root": { | ||
paddingTop: 0, | ||
paddingBottom: 0, | ||
}, | ||
}, | ||
action: { | ||
alignSelf: "center", | ||
}, | ||
}), | ||
}); |
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,77 @@ | ||
import { ArrowRight, Reload } from "@comet/admin-icons"; | ||
import { Button, Card, CardContent, CardHeader, Grid, 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> | ||
); | ||
}; |
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.
Simply removing the padding makes the button look weird during click/focus...
In the design it seems this is a custom button anyway, as the hover is different than in other buttons.
I will check with UX to see if this is on purpose or if we can use an existing button variant here.
Screen.Recording.2024-12-05.at.17.38.20.mov
Screen.Recording.2024-12-05.at.17.33.45.mov