Skip to content

Commit

Permalink
New Dashboard for Admins (#183)
Browse files Browse the repository at this point in the history
- Modify Alert component to support `isCloseable` property, which enables or disables the close button in alerts.
- Update styling for root element, message, title, action, and closeButton classes to improve visual consistency across alert types.
  • Loading branch information
johan-fx authored Aug 5, 2024
1 parent debfad6 commit efea07a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/feedback/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Alert = ({
() => closeable && !isNil(closeable) && closeable !== '',
[closeable],
);
const { classes } = AlertStyles({ variant, severity }, { name: 'Alert' });
const { classes } = AlertStyles({ variant, severity, isCloseable }, { name: 'Alert' });

return (
<MantineAlert
Expand Down
22 changes: 6 additions & 16 deletions packages/components/src/feedback/Alert/Alert.styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../theme.mixins';
import { pxToRem } from '../../theme.mixins';

const getColor = (theme, severity) =>
({
Expand Down Expand Up @@ -37,8 +37,7 @@ const getColor = (theme, severity) =>
},
})[severity];

const AlertStyles = createStyles((theme, { variant, severity }) => {
const alertTheme = theme;
const AlertStyles = createStyles((theme, { variant, severity, isCloseable }) => {
const titleSize = variant === 'block' ? 'md--bold' : 'sm--bold';
return {
root: {
Expand All @@ -47,7 +46,8 @@ const AlertStyles = createStyles((theme, { variant, severity }) => {
display: 'flex',
alignItems: 'center',
borderRadius: 4,
padding: `${pxToRem(6)} ${pxToRem(16)} ${pxToRem(6)} ${pxToRem(16)}`,
padding: pxToRem(6),
paddingLeft: pxToRem(16),
borderLeftWidth: 4,
},
message: {},
Expand All @@ -63,7 +63,6 @@ const AlertStyles = createStyles((theme, { variant, severity }) => {
flex: '1 1 100%',
display: 'flex',
flexDirection: variant === 'block' ? 'column' : null,
// transform: variant === 'block' ? 'translateY(-2px)' : 'translateY(4px)',
gap: theme.spacing['1'],
},
title: {
Expand All @@ -81,25 +80,16 @@ const AlertStyles = createStyles((theme, { variant, severity }) => {
flex: '1 1 100%',
marginRight: variant === 'block' ? pxToRem(24) : pxToRem(28),
lineHeight: 1.2,
// marginTop: pxToRem(4),
// paddingTop: pxToRem(3.6),
paddingTop: theme.spacing[2],
paddingBottom: theme.spacing[2],
},
action: {
marginRight: pxToRem(30),
// marginTop: variant === 'block' ? pxToRem(5) : null,
// paddingTop: variant === 'block' ? null : pxToRem(3),
},
closeButton: {
// color: theme.colors.text05,
// transform: 'translateY(3px)',
marginRight: isCloseable ? pxToRem(30) : null,
},
closeButton: {},
icon: {
marginRight: pxToRem(8),
transform: 'translateY(2px)',
// marginTop: pxToRem(3),
// paddingTop: pxToRem(2),
},
};
});
Expand Down

0 comments on commit efea07a

Please sign in to comment.