-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR standardizes our styles for the `Card` component. What has been done: - In many places we have set `padding={0}` for the `CardBody`. Let's set a single common padding for the Card component. - Updated header styles for the cards. - Removed the border for the `Card` component and the unneeded `elevated` variant. - Removed unneeded props that are already defined in the card theme.⚠️ Important notice⚠️ Many things probably still need to be improved, but I believe this PR cleans our code a bit. Let's make the next fixes and integrate with styleguide in the next steps.
- Loading branch information
Showing
12 changed files
with
52 additions
and
93 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
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
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
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
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
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
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 |
---|---|---|
@@ -1,40 +1,29 @@ | ||
import { ComponentMultiStyleConfig, StyleFunctionProps } from "@chakra-ui/react" | ||
import { createMultiStyleConfigHelpers, defineStyle } from "@chakra-ui/react" | ||
import { cardAnatomy as parts } from "@chakra-ui/anatomy" | ||
|
||
export const cardTheme: ComponentMultiStyleConfig = { | ||
baseStyle: { | ||
container: { | ||
boxShadow: "none", | ||
borderColor: "gold.100", | ||
bg: "gold.200", | ||
}, | ||
}, | ||
parts: parts.keys, | ||
variants: { | ||
elevated: ({ colorScheme }: StyleFunctionProps) => { | ||
if (!colorScheme) return {} | ||
const multiStyleConfig = createMultiStyleConfigHelpers(parts.keys) | ||
|
||
return { | ||
container: { | ||
bg: "gold.100", | ||
borderColor: "white", | ||
}, | ||
} | ||
}, | ||
}, | ||
sizes: { | ||
md: { | ||
container: { | ||
borderWidth: "1px", | ||
}, | ||
}, | ||
lg: { | ||
container: { | ||
borderWidth: "2px", | ||
}, | ||
}, | ||
}, | ||
defaultProps: { | ||
size: "lg", | ||
}, | ||
} | ||
const baseStyleContainer = defineStyle({ | ||
boxShadow: "none", | ||
bg: "gold.200", | ||
borderRadius: "xl", | ||
p: 5, | ||
}) | ||
|
||
const baseStyleHeader = defineStyle({ | ||
p: 0, | ||
}) | ||
|
||
const baseStyleBody = defineStyle({ | ||
p: 0, | ||
}) | ||
|
||
const baseStyle = multiStyleConfig.definePartsStyle({ | ||
container: baseStyleContainer, | ||
header: baseStyleHeader, | ||
body: baseStyleBody, | ||
}) | ||
|
||
export const cardTheme = multiStyleConfig.defineMultiStyleConfig({ | ||
baseStyle, | ||
}) |