Skip to content

Commit

Permalink
feat(message-box): subtle styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Jan 17, 2025
1 parent 7fcdaf4 commit b0e9c97
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/components/message-box/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type MessageBoxProps = {
noStatusIcon?: boolean;
onClick?: () => void;
borderRadius?: boolean;
subtle?: boolean;
};

export const MessageBox = ({
Expand All @@ -32,12 +33,13 @@ export const MessageBox = ({
title,
onClick,
borderRadius = true,
subtle = false
}: MessageBoxProps) => {
const { color: {status} } = useTheme();
const { t } = useTranslation();
const backgroundColorStyle: HTMLAttributes<HTMLDivElement>['style'] = {
borderColor: status[type].primary.background,
backgroundColor: status[type].secondary.background,
borderColor: subtle ? undefined : status[type].primary.background,
backgroundColor: subtle ? undefined : status[type].secondary.background,
color: status[type].secondary.foreground.primary,
};
const overrideMode = useStatusThemeColor(type);
Expand All @@ -50,6 +52,7 @@ export const MessageBox = ({
className={andIf({
[style.container]: true,
[style.borderRadius]: borderRadius,
[style.subtle]: subtle
})}
style={backgroundColorStyle}
>
Expand Down
4 changes: 4 additions & 0 deletions src/components/message-box/message-box.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
.borderRadius {
border-radius: token('border.radius.regular');
}
.subtle {
background-color: token('color.background.neutral.0.background') !important;
border: none;
}
.content {
display: flex;
flex-direction: column;
Expand Down
3 changes: 2 additions & 1 deletion src/modules/global-messages/global-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MessageBox } from '@atb/components/message-box';
import { getTextForLanguage, useTranslation } from '@atb/translations';
import { and } from '@atb/utils/css';
import { useActiveGlobalMessages } from './context';
import { GlobalMessageContextEnum } from './types';
import { GlobalMessageContextEnum, GlobalMessageType } from './types';
import style from './global-messages.module.css';
import { motion } from 'framer-motion';

Expand Down Expand Up @@ -46,6 +46,7 @@ export function GlobalMessages({ context, className }: GlobalMessagesProps) {
type={message.type}
title={getTextForLanguage(message.title, language)}
message={getTextForLanguage(message.body, language) ?? ''}
subtle={message.subtle}
/>
</motion.div>
))}
Expand Down

0 comments on commit b0e9c97

Please sign in to comment.