@nuskin/foundation-ui-components 1.0.0-develop.4 → 1.0.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -4
- package/src/common/accordion/specs/NsAccordion.spec.tsx +3 -1
- package/src/common/accordion/specs/NsAccordionHeader.spec.tsx +21 -5
- package/src/common/accordion/specs/NsAccordionItem.spec.tsx +29 -5
- package/src/common/accordion/specs/NsCollapse.spec.tsx +4 -4
- package/src/common/accordion/specs/NsToggleSection.spec.tsx +10 -5
- package/src/common/alert/NsAlert.spec.tsx +0 -1
- package/src/common/alert/NsAlert.styled.ts +10 -10
- package/src/common/alert/NsAlert.tsx +4 -3
- package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +12 -11
- package/src/common/auth-dropdown/NsAuthDropdown.tsx +2 -1
- package/src/common/auth-dropdown/types.d.ts +3 -1
- package/src/common/brand-components/NsBrandComponent.tsx +3 -0
- package/src/common/breadcrumb/NsBreadcrumb.tsx +4 -2
- package/src/common/button/NsButton.spec.tsx +1 -1
- package/src/common/button/NsButton.stories.tsx +1 -1
- package/src/common/button/NsButton.styled.tsx +25 -23
- package/src/common/button/NsButton.tsx +9 -2
- package/src/common/button/types.d.ts +1 -0
- package/src/common/common.types.d.ts +1 -0
- package/src/common/dropdown/types.d.ts +3 -1
- package/src/common/flag/NsFlag.spec.tsx +1 -0
- package/src/common/flag/NsFlag.styled.tsx +5 -5
- package/src/common/icon/types.d.ts +1 -0
- package/src/common/input/InputFieldWrapper.tsx +4 -4
- package/src/common/label/NsLabel.tsx +11 -7
- package/src/common/nav-tab/NsNavTab.styled.tsx +7 -4
- package/src/common/radiogroup/NsRadioGroup.spec.tsx +2 -1
- package/src/common/radiogroup/NsRadioGroup.stories.tsx +2 -1
- package/src/common/radiogroup/NsRadioGroup.styled.tsx +26 -32
- package/src/common/radiogroup/NsRadioGroup.tsx +20 -5
- package/src/common/radiogroup/types.d.ts +4 -3
- package/src/common/select/NsSelect.styled.tsx +19 -23
- package/src/common/table/NsTable.styled.ts +69 -66
- package/src/common/text-strip/NsTextStrip.tsx +10 -7
- package/src/common/typography/Typography.styled.tsx +3 -3
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { useTheme } from '@mui/material/styles';
|
|
3
|
+
|
|
2
4
|
import StyledButton from './NsButton.styled';
|
|
5
|
+
|
|
3
6
|
import { NsButtonProps } from './types.d';
|
|
7
|
+
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
4
8
|
|
|
5
|
-
const NsButton = ({ children, ...props }: PropsWithChildren<NsButtonProps>) => {
|
|
9
|
+
const NsButton = ({ children, darkModeEnabled = true, ...props }: PropsWithChildren<NsButtonProps>) => {
|
|
10
|
+
const { color } = props;
|
|
11
|
+
const { palette } = useTheme();
|
|
12
|
+
const btnColor = (color && palette?.[color] ? color : 'primary') as FoundationTheme.PaletteColors;
|
|
6
13
|
return (
|
|
7
|
-
<StyledButton {...props} disableRipple>
|
|
14
|
+
<StyledButton {...props} color={btnColor} disableRipple darkModeEnabled={darkModeEnabled}>
|
|
8
15
|
{children}
|
|
9
16
|
</StyledButton>
|
|
10
17
|
);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import { AdditionalProps } from '../common.types';
|
|
5
|
+
|
|
6
|
+
export interface DropdownProps extends AdditionalProps {
|
|
5
7
|
selectedValue: string;
|
|
6
8
|
selectedLabel: string;
|
|
7
9
|
onSelect: (arg: string) => void; // eslint-disable-line
|
|
@@ -9,6 +9,8 @@ import { styled, ColorUtils, FoundationTheme } from '@nuskin/foundation-theme';
|
|
|
9
9
|
|
|
10
10
|
import { NsFlagSize } from './types.d';
|
|
11
11
|
|
|
12
|
+
const { paletteColor } = ColorUtils;
|
|
13
|
+
|
|
12
14
|
type NsFlagThemeParams = {
|
|
13
15
|
$size: NsFlagSize;
|
|
14
16
|
$bgColor?: FoundationTheme.PaletteColors;
|
|
@@ -33,11 +35,9 @@ const makeFlagSize = ({ $size }: { $size: NsFlagSize }) => {
|
|
|
33
35
|
return sizeValue / FLAG_SCALE_VALUE;
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
const { getPaletteColor } = ColorUtils;
|
|
37
|
-
|
|
38
38
|
const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme }: NsFlagThemeParams) => {
|
|
39
39
|
if (theme) {
|
|
40
|
-
return `${makeFlagSize({ $size })}px solid ${
|
|
40
|
+
return `${makeFlagSize({ $size })}px solid ${paletteColor($bgColor)({ theme })}`;
|
|
41
41
|
}
|
|
42
42
|
return '';
|
|
43
43
|
};
|
|
@@ -45,8 +45,8 @@ const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme }: NsFlagTheme
|
|
|
45
45
|
export const StyledFlag = styled('span')<NsFlagThemeParams>`
|
|
46
46
|
min-width: 29px;
|
|
47
47
|
height: ${getFlagHeight}px;
|
|
48
|
-
color: ${({ $bgColor = 'accentColorA', theme }) =>
|
|
49
|
-
background: ${({ $bgColor = 'accentColorA', theme }) =>
|
|
48
|
+
color: ${({ $bgColor = 'accentColorA', theme }) => paletteColor($bgColor, 'contrastText')({ theme })};
|
|
49
|
+
background: ${({ $bgColor = 'accentColorA', theme }) => paletteColor($bgColor)({ theme })};
|
|
50
50
|
position: relative;
|
|
51
51
|
padding: 0 15px;
|
|
52
52
|
display: inline-grid;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stack } from '@mui/material';
|
|
2
2
|
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
3
|
-
const {
|
|
3
|
+
const { color, paletteColor } = ColorUtils;
|
|
4
4
|
|
|
5
5
|
const InputFieldWrapper = styled(Stack)(({ theme }: any) => {
|
|
6
6
|
return {
|
|
@@ -10,12 +10,12 @@ const InputFieldWrapper = styled(Stack)(({ theme }: any) => {
|
|
|
10
10
|
'.MuiFormHelperText-root': {
|
|
11
11
|
fontSize: '11px',
|
|
12
12
|
marginTop: 0,
|
|
13
|
-
color:
|
|
13
|
+
color: paletteColor('primary', 'main')({ theme }),
|
|
14
14
|
'&.success': {
|
|
15
|
-
color:
|
|
15
|
+
color: color('success', '40')({ theme }),
|
|
16
16
|
},
|
|
17
17
|
'&.error': {
|
|
18
|
-
color:
|
|
18
|
+
color: paletteColor('error', 'main')({ theme }),
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
1
3
|
import { FormLabel } from '@mui/material';
|
|
2
|
-
|
|
4
|
+
|
|
3
5
|
import { styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
import { NsLabelProps } from './types.d';
|
|
8
|
+
|
|
9
|
+
const { paletteColor, isDarkMode, color } = ColorUtils;
|
|
6
10
|
|
|
7
11
|
const StyledLabel = styled(FormLabel)<{ fontSize?: number; style?: CSSProperties }>(({ theme, fontSize, style }) => {
|
|
8
|
-
const isLight = theme
|
|
12
|
+
const isLight = !isDarkMode({ theme });
|
|
9
13
|
return {
|
|
10
14
|
fontSize: fontSize ? `${fontSize}px` : '14px',
|
|
11
15
|
textAlign: style?.textAlign ?? 'left',
|
|
12
|
-
color:
|
|
16
|
+
color: paletteColor('primary', 'main')({ theme }),
|
|
13
17
|
'.optional-label': {
|
|
14
|
-
color: isLight ?
|
|
18
|
+
color: isLight ? color('neutral', '60')({ theme }) : color('neutral', '50')({ theme }),
|
|
15
19
|
},
|
|
16
20
|
'.MuiInputLabel-asterisk': {
|
|
17
|
-
color: isLight ?
|
|
21
|
+
color: isLight ? color('error', '40')({ theme }) : color('error', '20')({ theme }),
|
|
18
22
|
},
|
|
19
23
|
...(style || {}),
|
|
20
24
|
} as any; // TODO: may be this "any" has to be fixed from foundation-theme
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { FoundationTheme, styled } from '@nuskin/foundation-theme';
|
|
1
|
+
import { FoundationTheme, styled, ColorUtils } from '@nuskin/foundation-theme';
|
|
2
2
|
import { motion } from 'framer-motion';
|
|
3
3
|
|
|
4
|
+
const { paletteColor } = ColorUtils;
|
|
5
|
+
|
|
6
|
+
|
|
4
7
|
export const NavTabContainer = styled.div`
|
|
5
8
|
.shadow {
|
|
6
9
|
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.15);
|
|
@@ -23,7 +26,7 @@ export const NavTabUnderLine = styled(motion.div)<{ color?: FoundationTheme.Pale
|
|
|
23
26
|
position: absolute;
|
|
24
27
|
bottom: -2px;
|
|
25
28
|
height: 2px;
|
|
26
|
-
background-color: ${({ theme
|
|
29
|
+
background-color: ${({ theme, color = 'primary' }) => paletteColor(color)({ theme })};
|
|
27
30
|
`;
|
|
28
31
|
|
|
29
32
|
export const NavDrawer = styled.div`
|
|
@@ -37,7 +40,7 @@ export const NavDrawer = styled.div`
|
|
|
37
40
|
width: 100%;
|
|
38
41
|
max-height: 590px;
|
|
39
42
|
|
|
40
|
-
background-color: ${(
|
|
43
|
+
background-color: ${paletteColor('primary', 'contrastText')};
|
|
41
44
|
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.15);
|
|
42
45
|
transition: all 0.15s ease-in-out;
|
|
43
46
|
overflow: hidden;
|
|
@@ -54,7 +57,7 @@ export const NavDrawerContainer = styled(motion.div)`
|
|
|
54
57
|
z-index: 1;
|
|
55
58
|
}
|
|
56
59
|
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.15);
|
|
57
|
-
background-color: ${(
|
|
60
|
+
background-color: ${paletteColor('primary', 'contrastText')};
|
|
58
61
|
width: 100%;
|
|
59
62
|
text-align: left;
|
|
60
63
|
max-height: 590px;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, fireEvent, screen } from '@testing-library/react';
|
|
3
3
|
import { NsRadioGroup } from './';
|
|
4
|
+
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
describe('NsRadioGroup', () => {
|
|
@@ -16,7 +17,7 @@ describe('NsRadioGroup', () => {
|
|
|
16
17
|
items: options,
|
|
17
18
|
name: 'test',
|
|
18
19
|
label: 'I choose to signup as',
|
|
19
|
-
color: '#272525',
|
|
20
|
+
color: '#272525' as FoundationTheme.PaletteColors,
|
|
20
21
|
additionalSlot: 'An additional slot allows for more text',
|
|
21
22
|
size: 24,
|
|
22
23
|
labelFontSize: 16,
|
|
@@ -3,6 +3,7 @@ import type { StoryObj, Meta } from '@storybook/react';
|
|
|
3
3
|
import { within, userEvent } from '@storybook/testing-library';
|
|
4
4
|
import { expect } from '@storybook/jest';
|
|
5
5
|
import { NsRadioGroup } from './'
|
|
6
|
+
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
6
7
|
|
|
7
8
|
type ComponentType = typeof NsRadioGroup;
|
|
8
9
|
type Story = StoryObj<ComponentType>;
|
|
@@ -77,7 +78,7 @@ export const RadioGroup: Story = {
|
|
|
77
78
|
],
|
|
78
79
|
name: 'test',
|
|
79
80
|
label: 'I choose to signup as',
|
|
80
|
-
color: '#272525',
|
|
81
|
+
color: '#272525' as FoundationTheme.PaletteColors,
|
|
81
82
|
additionalSlot: 'An additional slot allows for more text',
|
|
82
83
|
size: 10,
|
|
83
84
|
labelFontSize: 16,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Radio, FormControlLabel, FormLabel, RadioGroup } from '@mui/material';
|
|
2
|
-
import { ColorUtils } from '@nuskin/foundation-theme';
|
|
3
|
-
import { styled, nuskinTheme } from '@nuskin/foundation-theme';
|
|
2
|
+
import { ColorUtils, FoundationTheme, styled } from '@nuskin/foundation-theme';
|
|
4
3
|
|
|
5
|
-
const {
|
|
6
|
-
const { colors } = nuskinTheme;
|
|
4
|
+
const { paletteColor, isDarkMode, color } = ColorUtils;
|
|
7
5
|
|
|
8
6
|
export const StyledHelperText = styled('div')`
|
|
9
7
|
margin-top :10px;
|
|
@@ -15,42 +13,38 @@ export const StyledHelperText = styled('div')`
|
|
|
15
13
|
export const StyledSpan = styled('span')`
|
|
16
14
|
font-size: '16px';
|
|
17
15
|
font-weight: 300;
|
|
18
|
-
color: ${(
|
|
16
|
+
color: ${paletteColor('primary')};
|
|
19
17
|
`;
|
|
20
18
|
|
|
21
|
-
export const StyledLabel = styled(FormLabel)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const StyledRadio = styled(Radio)(({ theme }) => {
|
|
30
|
-
const isLight = theme.palette?.primary?.main === '#252525';
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
color: isLight ? colors.primary.black : colors.primary.white,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
19
|
+
export const StyledLabel = styled(FormLabel)`
|
|
20
|
+
color: ${paletteColor('primary')},
|
|
21
|
+
marginBottom: '15px',
|
|
22
|
+
backgroundColor: 'transparent',
|
|
23
|
+
`;
|
|
36
24
|
|
|
37
|
-
export const
|
|
38
|
-
|
|
25
|
+
export const StyledRadio = styled(Radio)`
|
|
26
|
+
color: ${(props) => !isDarkMode(props) ? color('primary', 'black')(props) : color('primary', 'white')(props)}
|
|
27
|
+
`;
|
|
39
28
|
|
|
29
|
+
export const StyledFormControlLabel = styled(FormControlLabel)<{ darkModeEnabled?: boolean }>((props) => {
|
|
40
30
|
return {
|
|
41
|
-
color:
|
|
31
|
+
color: paletteColor('primary')(props),
|
|
42
32
|
marginBottom: '10px',
|
|
43
33
|
'.MuiFormControlLabel-label.Mui-disabled': {
|
|
44
|
-
color:
|
|
34
|
+
color: `${!isDarkMode(props) ? color('neutral', 60)(props) : color('neutral', 20)(props)}`
|
|
45
35
|
},
|
|
46
36
|
};
|
|
47
37
|
});
|
|
48
38
|
|
|
49
|
-
export const StyledRadioGroup = styled(RadioGroup)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
39
|
+
export const StyledRadioGroup = styled(RadioGroup)<
|
|
40
|
+
{ color: FoundationTheme.PaletteColors; darkModeEnabled?: boolean }
|
|
41
|
+
>(
|
|
42
|
+
({ theme, color, darkModeEnabled }) => {
|
|
43
|
+
return {
|
|
44
|
+
marginTop: '10px',
|
|
45
|
+
'.MuiRadio-root.custom-radio.Mui-checked': {
|
|
46
|
+
color: paletteColor(color)({ theme, darkModeEnabled })
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormControl } from '@mui/material';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import {
|
|
4
4
|
StyledHelperText,
|
|
5
5
|
StyledFormControlLabel,
|
|
@@ -9,19 +9,33 @@ import {
|
|
|
9
9
|
} from './NsRadioGroup.styled';
|
|
10
10
|
import { NsLabel } from '../label';
|
|
11
11
|
|
|
12
|
+
import { NsRadioGroupProps } from './types';
|
|
13
|
+
|
|
12
14
|
const NsRadioGroup = (props: NsRadioGroupProps) => {
|
|
13
|
-
const {
|
|
15
|
+
const {
|
|
16
|
+
items,
|
|
17
|
+
additionalSlot,
|
|
18
|
+
label,
|
|
19
|
+
onChange,
|
|
20
|
+
color,
|
|
21
|
+
disable,
|
|
22
|
+
size,
|
|
23
|
+
additionalProps,
|
|
24
|
+
labelFontSize,
|
|
25
|
+
darkModeEnabled = true
|
|
26
|
+
} = props;
|
|
14
27
|
|
|
15
28
|
return (
|
|
16
29
|
<>
|
|
17
30
|
<FormControl data-testid={additionalProps?.testid}>
|
|
18
31
|
<NsLabel size={labelFontSize}>{label}</NsLabel>
|
|
19
32
|
<StyledRadioGroup
|
|
20
|
-
aria-labelledby="
|
|
33
|
+
aria-labelledby="radio-buttons-group-label"
|
|
21
34
|
defaultValue={items?.[0]?.value}
|
|
22
35
|
name="radio-buttons-group"
|
|
23
36
|
onChange={onChange}
|
|
24
37
|
color={color}
|
|
38
|
+
darkModeEnabled={darkModeEnabled}
|
|
25
39
|
>
|
|
26
40
|
{items?.map((item, index) => (
|
|
27
41
|
<StyledFormControlLabel
|
|
@@ -31,13 +45,14 @@ const NsRadioGroup = (props: NsRadioGroupProps) => {
|
|
|
31
45
|
control={<StyledRadio className="custom-radio" />}
|
|
32
46
|
label={item?.label}
|
|
33
47
|
disabled={disable}
|
|
48
|
+
darkModeEnabled={darkModeEnabled}
|
|
34
49
|
/>
|
|
35
50
|
))}
|
|
36
51
|
</StyledRadioGroup>
|
|
37
52
|
</FormControl>
|
|
38
|
-
{additionalSlot
|
|
53
|
+
{additionalSlot ? <StyledHelperText className={`ml-${size}`}>
|
|
39
54
|
<StyledSpan className="text-sm">{additionalSlot}</StyledSpan>
|
|
40
|
-
</StyledHelperText>}
|
|
55
|
+
</StyledHelperText> : null}
|
|
41
56
|
|
|
42
57
|
</>
|
|
43
58
|
);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
1
2
|
import { AdditionalProps } from '../common.types';
|
|
2
3
|
|
|
3
|
-
export type NsRadioGroupProps =
|
|
4
|
+
export type NsRadioGroupProps = {
|
|
4
5
|
disable : boolean ;
|
|
5
6
|
name : string;
|
|
6
7
|
additionalSlot : string;
|
|
7
8
|
label : string ;
|
|
8
9
|
items: RadioItems[] ;
|
|
9
|
-
color
|
|
10
|
+
color: FoundationTheme.PaletteColors;
|
|
10
11
|
size : number;
|
|
11
12
|
labelFontSize:number,
|
|
12
13
|
onChange : () => void;
|
|
13
|
-
}
|
|
14
|
+
} & AdditionalProps;
|
|
14
15
|
|
|
15
16
|
export type RadioItems = {
|
|
16
17
|
label : string ;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled, ColorUtils, FoundationTheme } from '@nuskin/foundation-theme';
|
|
2
|
-
const {
|
|
2
|
+
const { color, paletteColor, isDarkMode } = ColorUtils;
|
|
3
3
|
|
|
4
4
|
export const SelectContainer = styled.div<{ disabled: boolean }>`
|
|
5
5
|
position: relative;
|
|
@@ -14,8 +14,8 @@ export const SelectHead = styled.div<{ type: string; disabled: boolean }>`
|
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
align-items: center;
|
|
16
16
|
border: ${({ type, theme }) =>
|
|
17
|
-
type === 'outlined' ? `1px solid ${
|
|
18
|
-
color: ${(
|
|
17
|
+
type === 'outlined' ? `1px solid ${color('primary', 'black')({ theme })}` : 'none'};
|
|
18
|
+
color: ${paletteColor('primary')};
|
|
19
19
|
width: 207px;
|
|
20
20
|
position: relative;
|
|
21
21
|
z-index: 2;
|
|
@@ -28,38 +28,34 @@ export const SelectButton = styled.div`
|
|
|
28
28
|
export const SelectList = styled.div<{ borderColor: FoundationTheme.PaletteColors }>`
|
|
29
29
|
position: absolute;
|
|
30
30
|
z-index: 100;
|
|
31
|
-
border: 1px solid ${({ borderColor, theme }) =>
|
|
31
|
+
border: 1px solid ${({ borderColor, theme }) => paletteColor(borderColor)({ theme })};
|
|
32
32
|
padding: 0;
|
|
33
33
|
margin: 0;
|
|
34
34
|
width: -webkit-fill-available;
|
|
35
|
-
color: ${(
|
|
36
|
-
background-color: ${(
|
|
35
|
+
color: ${paletteColor('primary')};
|
|
36
|
+
background-color: ${paletteColor('primary', 'contrastText')};
|
|
37
37
|
`;
|
|
38
|
-
const getIsLight = (theme: FoundationTheme.Theme) => {
|
|
39
|
-
const { palette = { primary: { main: '', contrastText: '' } } } = theme;
|
|
40
|
-
return palette.primary.main === getAppColor(theme, 'primary', 'black');
|
|
41
|
-
};
|
|
42
38
|
|
|
43
|
-
const getDividerColor = (theme: FoundationTheme.Theme) => {
|
|
44
|
-
const
|
|
45
|
-
const dividerColor = isLight ? getAppColor(theme, 'neutral', '30') : getAppColor(theme, 'neutral', '20');
|
|
39
|
+
const getDividerColor = (props: { theme: FoundationTheme.Theme}) => {
|
|
40
|
+
const dividerColor = !isDarkMode(props) ? color('neutral', '30')(props) : color('neutral', '20')(props);
|
|
46
41
|
return dividerColor;
|
|
47
42
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const bgColor =
|
|
43
|
+
|
|
44
|
+
const getListBgColor = (props: { theme: FoundationTheme.Theme }) => {
|
|
45
|
+
const bgColor = !isDarkMode(props) ? color('accentColorB', '10')(props) : color('accentColorB', '50')(props);
|
|
51
46
|
return bgColor;
|
|
52
47
|
};
|
|
48
|
+
|
|
53
49
|
export const ListItemContainer = styled.div<{ showListDivider: boolean; isSelected: boolean }>`
|
|
54
50
|
${({ showListDivider, isSelected, theme }) => `
|
|
55
51
|
cursor: pointer;
|
|
56
52
|
padding: 5px 0;
|
|
57
|
-
border-bottom: 1px solid ${showListDivider ? getDividerColor(theme) : 'none'};
|
|
58
|
-
background-color: ${isSelected ?
|
|
53
|
+
border-bottom: 1px solid ${showListDivider ? getDividerColor({ theme }) : 'none'};
|
|
54
|
+
background-color: ${isSelected ? paletteColor('primary')({ theme }) : 'white'};
|
|
59
55
|
color: ${isSelected ? 'white' : 'black'};
|
|
60
56
|
|
|
61
57
|
&:hover {
|
|
62
|
-
background-color: ${getListBgColor(theme)};
|
|
58
|
+
background-color: ${getListBgColor({ theme })};
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
&:last-child {
|
|
@@ -71,13 +67,13 @@ export const ListItemContainer = styled.div<{ showListDivider: boolean; isSelect
|
|
|
71
67
|
export const ListItem = styled.div<{ isSelected: boolean}>`
|
|
72
68
|
padding: 5px 10px;
|
|
73
69
|
border-left: ${({ isSelected, theme }) =>
|
|
74
|
-
isSelected ? `2px solid ${
|
|
70
|
+
isSelected ? `2px solid ${paletteColor('primary')({ theme })}` : 'none'};
|
|
75
71
|
background-color: ${({ isSelected, theme }) =>
|
|
76
|
-
isSelected ?
|
|
72
|
+
isSelected ? paletteColor('primary', 'main')({ theme }) : 'white'};
|
|
77
73
|
color: ${({ isSelected }) => (isSelected ? 'white' : 'black')};
|
|
78
74
|
&:hover {
|
|
79
75
|
background-color: ${({ isSelected, theme }) =>
|
|
80
|
-
isSelected ?
|
|
76
|
+
isSelected ? paletteColor('primary')({ theme }) : getListBgColor({ theme })};
|
|
81
77
|
font-weight: bold;
|
|
82
78
|
}
|
|
83
79
|
`;
|
|
@@ -85,5 +81,5 @@ export const ListItem = styled.div<{ isSelected: boolean}>`
|
|
|
85
81
|
export const SelectLabel = styled.label`
|
|
86
82
|
display: block;
|
|
87
83
|
margin-bottom: 5px;
|
|
88
|
-
color: ${(
|
|
84
|
+
color: ${paletteColor('primary')} !important;
|
|
89
85
|
`;
|