Skip to content

Commit

Permalink
fix(ScoreFrontStage): refactor styles and colors
Browse files Browse the repository at this point in the history
  • Loading branch information
fermarinsanchez committed Feb 7, 2024
1 parent 6b0c4fb commit 713c37e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { isDate, isFunction } from 'lodash';
import { ItemStyles } from './Item.styles';
import { ITEM_DEFAULT_PROPS, ITEM_PROP_TYPES } from './Item.constants';
import { Box } from '../../../layout';
import { isDate, isFunction } from 'lodash';
import { Badge } from '../Badge';

const Item = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../../theme.mixins';

export const ItemStyles = createStyles((theme, {}) => {
const ItemStyles = createStyles((theme, {}) => {
const scoreTheme = theme.other.score;
return {
root: {
borderTop: `${scoreTheme.border.width} solid ${scoreTheme.border.color.neutral.emphasis}`,
backgroundColor: scoreTheme.background.color.neutral.subtle,
padding: scoreTheme.spacing.padding.md,
'&:hover': {
backgroundColor: scoreTheme.background.color.neutral.hover,
Expand Down Expand Up @@ -41,3 +39,5 @@ export const ItemStyles = createStyles((theme, {}) => {
},
};
});

export { ItemStyles };
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const ScoreFronstage = ({
maxGrade,
values,
locale,
subjectColor,
...props
}) => {
const { classes } = ScoreFronstageStyles({}, { name: 'ScoreFronstage' });
Expand All @@ -34,6 +35,7 @@ const ScoreFronstage = ({
size="lg"
icon={icon ? <ImageLoader src={icon} height={'100%'} forceImage /> : null}
showIconAndImage
subjectColor={subjectColor}
/>
</Box>
<Box className={classes.header}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createStyles } from '@mantine/styles';

export const ScoreFronstageStyles = createStyles((theme, {}) => {
const ScoreFronstageStyles = createStyles((theme, {}) => {
const scoreTheme = theme.other.score;
const paddingLg = scoreTheme.spacing.padding.lg;
return {
Expand All @@ -18,7 +18,7 @@ export const ScoreFronstageStyles = createStyles((theme, {}) => {
},
header: {
padding: `56px ${paddingLg} ${paddingLg} ${paddingLg}`,
backgroundColor: scoreTheme.background.color.neutral.subtle,
// backgroundColor: scoreTheme.background.color.neutral.subtle,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
Expand All @@ -42,3 +42,5 @@ export const ScoreFronstageStyles = createStyles((theme, {}) => {
},
};
});

export { ScoreFronstageStyles };
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const AVATAR_DEFAULT_PROPS = {
size: 'md',
state: 'normal',
showIconAndImage: false,
subjectColor: '#96D47F',
};
export const AVATAR_PROP_TYPES = {
image: PropTypes.string,
Expand All @@ -32,4 +33,5 @@ export const AVATAR_PROP_TYPES = {
fullName: PropTypes.string,
icon: PropTypes.any,
alt: PropTypes.string,
subjectColor: PropTypes.string,
};
10 changes: 9 additions & 1 deletion packages/components/src/informative/Avatar/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Avatar = forwardRef(
image,
icon,
color,
subjectColor,
initials,
fullName,
radius = true,
Expand Down Expand Up @@ -43,7 +44,14 @@ const Avatar = forwardRef(
}
}

const { classes, theme } = AvatarStyles({ radius, color, size, state, activityStatus });
const { classes, theme } = AvatarStyles({
radius,
color,
size,
state,
activityStatus,
subjectColor,
});

return (
<Box className={classes.avatarWrapper}>
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/informative/Avatar/Avatar.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const getIconWrapperStyles = (size, theme, badgeTheme) => {
};

export const AvatarStyles = createStyles(
(theme, { size, radius, color, state, activityStatus }) => {
(theme, { size, radius, color, state, activityStatus, subjectColor }) => {
const avatarTheme = theme.other.avatar;
const badgeTheme = theme.other.badge;

Expand All @@ -89,7 +89,7 @@ export const AvatarStyles = createStyles(
iconWrapper: {
display: size === 'sm' && 'none',
boxSizing: 'content-box',
backgroundColor: badgeTheme.background.color.primary.default,
backgroundColor: subjectColor,
borderRadius: radius ? badgeTheme.border.radius : 0,
position: 'absolute',
...getIconWrapperStyles(size, theme, badgeTheme),
Expand All @@ -100,5 +100,5 @@ export const AvatarStyles = createStyles(
},
},
};
}
},
);

0 comments on commit 713c37e

Please sign in to comment.