Skip to content

Commit

Permalink
fix(Card): header alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
zettca committed Nov 13, 2023
1 parent 6beb486 commit 14b85a5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/core/src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export const Main: StoryObj<HvCardProps> = {
selectable={selectable}
selected={selected}
>
<HvCardHeader title="Asset Avatar L90" subheader="Compressor" />
<HvCardHeader
title="Asset Avatar L90"
subheader="Compressor"
icon={<Level2Average color={statusColor} />}
/>
<HvCardMedia
component="img"
alt="Compressor"
Expand Down
13 changes: 6 additions & 7 deletions packages/core/src/components/Card/Header/Header.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import { theme } from "@hitachivantara/uikit-styles";
import { createClasses } from "@core/utils/classes";

export const { staticClasses, useClasses } = createClasses("HvCardHeader", {
root: { padding: `15px ${theme.space.sm}`, position: "relative" },
root: {
position: "relative",
padding: theme.spacing("12px", "xs", "sm", "sm"),
},
titleShort: {
...theme.typography.label,
fontFamily: theme.fontFamily.body,
marginRight: "30px",
},
title: {
...theme.typography.label,
Expand All @@ -18,11 +21,7 @@ export const { staticClasses, useClasses } = createClasses("HvCardHeader", {
},
content: {},
action: {
position: "absolute",
right: 20,
marginTop: 0,
marginRight: "0px",
margin: 0,
paddingLeft: theme.space.xs,
top: "15px",
},
});
1 change: 1 addition & 0 deletions packages/core/src/components/Card/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const HvCardHeader = (props: HvCardHeaderProps) => {
className={cx(classes.root, className)}
classes={{
title: cx({
// TODO: review conditional in v6
[classes.titleShort]: icon,
[classes.title]: !icon,
}),
Expand Down
6 changes: 6 additions & 0 deletions packages/styles/src/themes/ds3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,15 @@ const ds3 = makeTheme((theme) => ({
},
HvCardHeader: {
classes: {
root: {
padding: theme.spacing("15px", "sm"),
},
title: {
...theme.typography.title3,
},
titleShort: {
...theme.typography.title3,
},
subheader: {
...theme.typography.body,
},
Expand Down

0 comments on commit 14b85a5

Please sign in to comment.