Skip to content

Commit 21e1b3c

Browse files
committed
fix(Snackbar): mode dark use ColorSchemeProvider
1 parent f4a372d commit 21e1b3c

12 files changed

Lines changed: 29 additions & 31 deletions

packages/vkui/src/components/Snackbar/subcomponents/Basic/Basic.module.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
}
4343
}
4444

45-
.modeDark {
46-
background: var(--vkui--color_background_contrast_inverse);
47-
}
48-
4945
.before {
5046
margin-inline-end: 12px;
5147
}
@@ -76,10 +72,6 @@
7672
color: var(--vkui--color_text_subhead);
7773
}
7874

79-
.modeDark .contentText {
80-
color: var(--vkui--color_text_contrast);
81-
}
82-
8375
/* layout */
8476
.layoutHorizontal .action {
8577
position: relative;

packages/vkui/src/components/Snackbar/subcomponents/Basic/Basic.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use client';
22

3-
import type * as React from 'react';
3+
import * as React from 'react';
44
import { classNames } from '@vkontakte/vkjs';
55
import { useAdaptivity } from '../../../../hooks/useAdaptivity';
66
import type { HTMLAttributesWithRootRef } from '../../../../types';
7+
import { ColorSchemeProvider } from '../../../ColorSchemeProvider/ColorSchemeProvider';
78
import { RootComponent } from '../../../RootComponent/RootComponent';
89
import { Paragraph } from '../../../Typography/Paragraph/Paragraph';
910
import { Subhead } from '../../../Typography/Subhead/Subhead';
@@ -74,14 +75,13 @@ export function Basic({
7475
const { density = 'none' } = useAdaptivity();
7576
const layout = after || subtitle ? 'vertical' : 'none';
7677

77-
return (
78+
const snackbar = (
7879
<RootComponent
7980
{...restProps}
8081
baseClassName={classNames(
8182
styles.body,
8283
stylesLayout[layoutProps || layout],
8384
density !== 'compact' && densityClassNames[density],
84-
mode === 'dark' && styles.modeDark,
8585
)}
8686
>
8787
{before && <div className={styles.before}>{before}</div>}
@@ -96,4 +96,10 @@ export function Basic({
9696
{after && <div className={styles.after}>{after}</div>}
9797
</RootComponent>
9898
);
99+
100+
if (mode === 'dark') {
101+
return <ColorSchemeProvider value="dark">{snackbar}</ColorSchemeProvider>;
102+
}
103+
104+
return snackbar;
99105
}
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)