Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/PlateNote/PlateNote.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ stories.add('simple', () => (
<Box mt="8px" mb="16px">
<PlateNote
text="The minimum amount of deposit is 0.1 WEST, the maximum amount of deposit is 500,000 WEST."
textProps={{ color: 'standard.$0' }}
textProps={{ color: 'warning.$500' }}
/>
</Box>
Type 'primary-info'
<Box mt="8px" mb="16px">
<PlateNote
type="primary-info"
text="The minimum amount of deposit is 0.1 WEST, the maximum amount of deposit is 500,000 WEST."
/>
</Box>
Type 'warning'
Expand Down
6 changes: 3 additions & 3 deletions src/components/PlateNote/PlateNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getMainColor } from './helpers';
import { Flex, TFlexProps } from '../Flex/Flex';
import { Text, TTextProps } from '../Text/Text';

export type TPlateNoteType = 'info' | 'warning' | 'error';
export type TPlateNoteType = 'info' | 'warning' | 'error' | 'primary-info';

export type TPlateNote = TFlexProps & {
type?: TPlateNoteType;
Expand All @@ -18,7 +18,7 @@ export const PlateNote: React.FC<TPlateNote> = ({
children,
...rest
}) => {
const mainColor = getMainColor(type);
const { mainColor, textColor } = getMainColor(type);

return (
<Flex
Expand All @@ -33,7 +33,7 @@ export const PlateNote: React.FC<TPlateNote> = ({
<Text
fontSize={14}
lineHeight="$20"
color={mainColor}
color={textColor}
{...textProps}
>
{text}
Expand Down
25 changes: 21 additions & 4 deletions src/components/PlateNote/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
import { TPlateNoteType } from './PlateNote';

export const getMainColor = (type: TPlateNoteType): string => {
export const getMainColor = (
type: TPlateNoteType
): { mainColor: string; textColor: string } => {
switch (type) {
case 'error': {
return 'danger.$300';
return {
mainColor: 'danger.$300',
textColor: 'danger.$300',
};
}
case 'warning': {
return 'warning.$500';
return {
mainColor: 'warning.$500',
textColor: 'warning.$500',
};
}
case 'primary-info': {
return {
mainColor: 'primary.$300',
textColor: 'standard.$0',
};
}
default: {
return 'main.$500';
return {
mainColor: 'main.$500',
textColor: 'main.$500',
};
}
}
};