@@ -197,12 +199,15 @@ const DrawerBackground = styled.div<{ $isOpen?: boolean }>`
const DrawerPanel = styled.div<{
$isOpen: boolean
}>`
+ display: flex;
+ flex-direction: column;
width: 500px;
max-width: 100vw;
height: 100vh;
- overflow-x: hidden;
- overflow-y: auto;
- background-color: ${({ theme }) => theme.colors.extended.grey[100]};
+ background-color: ${({ theme }) =>
+ theme.darkMode
+ ? theme.colors.extended.dark[600]
+ : theme.colors.extended.grey[100]};
transition: transform 0.5s ease-in-out;
position: fixed;
right: 0;
@@ -216,6 +221,11 @@ const DrawerPanel = styled.div<{
`}
`
+const DrawerContentWrapper = styled.div`
+ overflow: auto;
+ flex-grow: 1;
+`
+
const DrawerContent = styled.div`
padding: 0 ${({ theme }) => theme.spacings.xxl};
padding-bottom: 2rem;
@@ -223,14 +233,12 @@ const DrawerContent = styled.div`
`
const DrawerFooter = styled.div`
- position: sticky;
- bottom: 0;
- left: 0;
- right: 0;
- background: ${({ theme }) => theme.colors.extended.grey[100]};
+ background-color: ${({ theme }) =>
+ theme.darkMode
+ ? theme.colors.extended.dark[600]
+ : theme.colors.extended.grey[100]};
padding: ${({ theme }) => theme.spacings.xl};
box-shadow: 0px 1px 15px rgba(0, 0, 0, 0.15);
- z-index: 10;
`
const StyledGrid = styled(Grid)`
@@ -239,11 +247,4 @@ const StyledGrid = styled(Grid)`
gap: ${({ theme }) => theme.spacings.md};
`
-const StyledCloseButtonContainer = styled(CloseButtonContainer)`
- position: sticky;
- top: 0;
- left: 0;
- right: 0;
- background: ${({ theme }) => theme.colors.extended.grey[100]};
- z-index: 10;
-`
+const StyledCloseButtonContainer = styled(CloseButtonContainer)``
diff --git a/site/source/design-system/field/DateField.tsx b/site/source/design-system/field/DateField.tsx
index a3d70aceb..001bec5a6 100644
--- a/site/source/design-system/field/DateField.tsx
+++ b/site/source/design-system/field/DateField.tsx
@@ -11,7 +11,7 @@ import { DayPicker, useInput } from 'react-day-picker'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
-import { useOnClickOutside } from '@/hooks/useClickOutside'
+import { useOnClickOutside } from '@/hooks/useOnClickOutside'
import { Button } from '../buttons'
import { Emoji } from '../emoji'
@@ -133,6 +133,7 @@ export default function DateField(props: DateFieldProps) {
theme.spacings.xxl};
justify-content: flex-end;
+ background-color: ${({ theme }) =>
+ theme.darkMode
+ ? theme.colors.extended.dark[600]
+ : theme.colors.extended.grey[100]};
`
+
export const CloseButton = styled.button`
display: inline-flex;
align-items: center;
@@ -263,6 +268,11 @@ export const CloseButton = styled.button`
:hover {
text-decoration: underline;
}
+ :focus {
+ ${FocusStyle}
+ box-shadow: inset 0 0 0 3px #ffffff;
+ outline-offset: -2px;
+ }
`
const PopoverContent = styled.div`
diff --git a/site/source/design-system/switch/Switch.tsx b/site/source/design-system/switch/Switch.tsx
index 2d4563095..e0b87c386 100644
--- a/site/source/design-system/switch/Switch.tsx
+++ b/site/source/design-system/switch/Switch.tsx
@@ -86,8 +86,15 @@ const LabelBody = styled(Body)`
cursor: pointer;
`
-const Text = styled.span`
- margin-right: ${({ theme }) => theme.spacings.xxs};
+const Text = styled.span<{ invertLabel?: boolean }>`
+ ${({ theme, invertLabel: $invertLabel }) =>
+ $invertLabel
+ ? css`
+ margin-left: ${theme.spacings.xxs};
+ `
+ : css`
+ margin-right: ${theme.spacings.xxs};
+ `};
`
type AriaSwitchProps = Parameters[0]
@@ -98,6 +105,10 @@ export type SwitchProps = AriaSwitchProps & {
children?: ReactNode
className?: string
role?: string
+ /**
+ * Invert the position of the label and the switch
+ */
+ invertLabel?: boolean
}
export const Switch = (props: SwitchProps) => {
@@ -106,6 +117,7 @@ export const Switch = (props: SwitchProps) => {
light = false,
children,
className,
+ invertLabel = false,
...ariaProps
} = props
const state = useToggleState(ariaProps)
@@ -116,8 +128,10 @@ export const Switch = (props: SwitchProps) => {
const { isSelected } = state
return (
-
- {children && {children}}
+
+ {children && !invertLabel && (
+ {children}
+ )}
{
disabled={isDisabled}
>
{
disabled={isDisabled}
/>
+ {children && invertLabel && (
+ {children}
+ )}
)
}
diff --git a/site/source/hooks/useClickOutside.ts b/site/source/hooks/useOnClickOutside.ts
similarity index 100%
rename from site/source/hooks/useClickOutside.ts
rename to site/source/hooks/useOnClickOutside.ts
diff --git a/site/source/hooks/useOnKeyDown.ts b/site/source/hooks/useOnKeyDown.ts
new file mode 100644
index 000000000..a1ceb4b71
--- /dev/null
+++ b/site/source/hooks/useOnKeyDown.ts
@@ -0,0 +1,19 @@
+import { useEffect } from 'react'
+
+export const useOnKeyDown = (
+ keyPress: string | null,
+ handler: (event: KeyboardEvent) => void
+) => {
+ useEffect(() => {
+ const listener = (event: KeyboardEvent) => {
+ if (!keyPress || event.key === keyPress) {
+ handler(event)
+ }
+ }
+ window.addEventListener('keydown', listener)
+
+ return () => {
+ window.removeEventListener('keydown', listener)
+ }
+ }, [handler, keyPress])
+}
diff --git a/site/source/pages/simulateurs/comparaison-statuts/components/AllerPlusLoinRevenus.tsx b/site/source/pages/simulateurs/comparaison-statuts/components/AllerPlusLoinRevenus.tsx
index ec0faf518..8cdade922 100644
--- a/site/source/pages/simulateurs/comparaison-statuts/components/AllerPlusLoinRevenus.tsx
+++ b/site/source/pages/simulateurs/comparaison-statuts/components/AllerPlusLoinRevenus.tsx
@@ -18,7 +18,7 @@ import { Grid, Spacing } from '@/design-system/layout'
import { Tag, TagType } from '@/design-system/tag'
import { Tooltip } from '@/design-system/tooltip'
import { Strong } from '@/design-system/typography'
-import { H1, H4, H5 } from '@/design-system/typography/heading'
+import { H2, H4, H5 } from '@/design-system/typography/heading'
import { Link, StyledLink } from '@/design-system/typography/link'
import { Body } from '@/design-system/typography/paragraphs'
import { answerQuestion } from '@/store/actions/actions'
@@ -62,8 +62,14 @@ const AllerPlusLoinRevenus = ({
return (
void }) => (
-
@@ -497,16 +503,14 @@ const FlexCentered = styled.div`
align-items: center;
`
-const Label = styled.label`
- margin-left: ${({ theme }) => theme.spacings.md};
- font-family: ${({ theme }) => theme.fonts.main};
- font-size: 1rem;
-`
-
const StyledArrowRightIcon = styled(ArrowRightIcon)`
margin-left: ${({ theme }) => theme.spacings.sm};
`
+const WrapperTable = styled.div`
+ overflow: auto;
+`
+
const StyledTable = styled.table`
width: 100%;
text-align: left;
@@ -519,6 +523,13 @@ const StyledTable = styled.table`
border-spacing: ${({ theme }) => theme.spacings.md}!important;
}
+ th {
+ color: ${({ theme }) =>
+ theme.darkMode
+ ? theme.colors.extended.grey[200]
+ : theme.colors.extended.grey[800]};
+ }
+
thead th {
text-align: center;
font-size: 0.75rem;