Fix css dark theme issue, update desing css border

pull/2524/head
Jérémy Rialland 2022-12-08 18:28:33 +01:00 committed by Jérémy Rialland
parent 67f0464b67
commit e4151299d0
5 changed files with 46 additions and 38 deletions

View File

@ -88,7 +88,7 @@ export const ToggleGroupContainer = styled.div<{
position: relative;
align-items: center;
z-index: 1;
border: 1px solid
border: 2px solid
${({ theme }) =>
theme.darkMode
? theme.colors.extended.dark[500]
@ -124,15 +124,15 @@ export const ToggleGroupContainer = styled.div<{
${InputRadio}:checked + ${VisibleRadio} {
z-index: 2;
border: 1px solid
border: 2px solid
${({ theme }) =>
theme.darkMode
? theme.colors.bases.primary[400]
: theme.colors.bases.primary[700]};
? theme.colors.bases.primary[300]
: theme.colors.bases.primary[600]};
background-color: ${({ theme }) =>
theme.darkMode
? theme.colors.bases.primary[500]
: theme.colors.bases.primary[200]};
? theme.colors.bases.primary[600]
: theme.colors.bases.primary[100]};
${({ mode }) => mode === 'tab' && TabModeCheckedStyle}
}

View File

@ -31,6 +31,7 @@ export const Label = styled.label`
position: absolute;
will-change: transform top font-size line-height color;
transition: all 0.1s;
transition: color 0s, background-color 0s;
${({ theme }) =>
theme.darkMode &&
css`
@ -96,6 +97,7 @@ interface WrapperProps {
}
export const Wrapper = styled.div<WrapperProps>`
overflow: hidden;
display: flex;
border-radius: ${({ theme }) => theme.box.borderRadius};
border: ${({ theme }) =>
@ -243,40 +245,47 @@ export function Select<T extends Record<string, unknown>>(
}, [])
return (
<Wrapper
ref={wrapperRef}
isOpen={state.isOpen}
hasError={false}
hasLabel={false}
>
<HiddenSelect
state={state}
triggerRef={ref}
label={props.label}
name={props.name}
/>
{props.label && (
<Label className={props.small ? 'sr-only' : ''} {...labelProps}>
{props.label}
</Label>
)}
<Button
{...mergeProps(omit(buttonProps, 'id'), focusProps)}
ref={ref}
isFocusVisible={isFocusVisible}
<Container>
<Wrapper
ref={wrapperRef}
isOpen={state.isOpen}
hasError={false}
hasLabel={false}
>
<Value {...valueProps}>
{state.selectedItem != null
? state.selectedItem.rendered
: t('select.value.default', 'Choisissez une option')}
</Value>
<StyledIcon />
</Button>
<HiddenSelect
state={state}
triggerRef={ref}
label={props.label}
name={props.name}
/>
{props.label && (
<Label className={props.small ? 'sr-only' : ''} {...labelProps}>
{props.label}
</Label>
)}
<Button
{...mergeProps(omit(buttonProps, 'id'), focusProps)}
ref={ref}
isFocusVisible={isFocusVisible}
>
<Value {...valueProps}>
{state.selectedItem != null
? state.selectedItem.rendered
: t('select.value.default', 'Choisissez une option')}
</Value>
<StyledIcon />
</Button>
</Wrapper>
{state.isOpen && (
<Popover isOpen={state.isOpen} onClose={() => state.close()}>
<ListBox {...menuProps} state={state} />
</Popover>
)}
</Wrapper>
</Container>
)
}
const Container = styled.div`
position: relative;
`

View File

@ -127,12 +127,10 @@ html, body, #js, #js > *, [data-overlay-container] {
*:before,
*:after {
box-sizing: inherit;
transition: color 0.15s, background-color 0.15s;
}
body {
margin: 0;
}

View File

@ -37,6 +37,7 @@ type BackgroundProps = {
}
const BackgroundStyle = styled.div<BackgroundProps>`
transition: color 0.15s, background-color 0.15s;
${({ $darkMode }) => {
if ($darkMode) {
return css`

View File

@ -1,5 +1,5 @@
import UFuzzy from '@leeoniya/ufuzzy'
import { useEffect, useRef, useState, Fragment } from 'react'
import { Fragment, useEffect, useRef, useState } from 'react'
import { TextField } from '@/design-system'
import { CardContainer } from '@/design-system/card/Card'