From 3fa99b28de5626a0719604eda635f764a1a26020 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Wed, 12 Oct 2022 13:30:39 +0600 Subject: [PATCH 01/10] add initial contrast theme --- pages/_app.tsx | 5 ++- src/components/App/index.tsx | 10 ++++++ src/components/Card/styles.module.css | 9 +++--- src/components/Footer/index.tsx | 17 +++++++--- src/components/Menu/styles.module.css | 8 ++++- src/components/Navigation/index.tsx | 2 ++ src/components/Wrapper/index.tsx | 23 ++++++++------ src/style/style.css | 45 +++++++++++++++++++++++++++ src/ui/Box/index.tsx | 4 ++- src/ui/Panel/index.tsx | 19 +++++++++++ src/ui/Panel/panel.module.css | 8 +++++ src/ui/theme/Theme.tsx | 17 ++++++++++ src/ui/theme/ThemeContext.ts | 4 +++ src/ui/theme/types.ts | 2 ++ src/ui/theme/useTheme.ts | 15 +++++++++ 15 files changed, 168 insertions(+), 20 deletions(-) create mode 100644 src/ui/Panel/index.tsx create mode 100644 src/ui/Panel/panel.module.css create mode 100644 src/ui/theme/Theme.tsx create mode 100644 src/ui/theme/ThemeContext.ts create mode 100644 src/ui/theme/types.ts create mode 100644 src/ui/theme/useTheme.ts diff --git a/pages/_app.tsx b/pages/_app.tsx index b69aeb2e..dbd8ca21 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -8,6 +8,7 @@ import App from "next/app" import Head from "next/head" import { YMetrika } from "src/components/YMetrika" import { GAnalytics } from "src/components/GAnalytics" +import { Theme } from "@/ui/theme/Theme" export default class MyApp extends App { render() { @@ -41,7 +42,9 @@ export default class MyApp extends App { - + + + ) } diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index 47ff5366..4e0a1cd5 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -10,6 +10,9 @@ import { useMobile } from "src/hooks/useMobile" import { Gosuslugi } from "../Gosuslugi" import { Navigation } from "@/components/Navigation" import { Box } from "@/ui/Box" +import { Button } from "@/ui/Button" +import { EyeOpenIcon } from "@radix-ui/react-icons" +import { useTheme } from "@/ui/theme/useTheme" export type AppProps = { showAuthor?: boolean @@ -25,6 +28,7 @@ export const App: React.FC = ({ showAuthor = false, menu, ...props }) const blockStyle = { justifyContent: "center", } + const { theme, setTheme } = useTheme() return ( = ({ showAuthor = false, menu, ...props }) }}> + + )} > diff --git a/src/components/Card/styles.module.css b/src/components/Card/styles.module.css index 1ed4a9c5..1a7dd3fa 100644 --- a/src/components/Card/styles.module.css +++ b/src/components/Card/styles.module.css @@ -5,6 +5,8 @@ box-shadow: var(--shadow); overflow: hidden; transition: box-shadow 150ms; + + border: var(--border); } .card:hover { @@ -52,8 +54,8 @@ border-radius: var(--radius) var(--radius) 0 0; width: 100%; - height: var(--radius); - top: calc(var(--radius) * -1); + height: var(--size-m); + top: calc(var(--size-m) * -1); left: 0; } @@ -68,10 +70,9 @@ position: absolute; --offset: var(--size-m); - --r: var(--size-s); left: var(--offset); right: var(--offset); bottom: var(--offset); - border-radius: var(--radius) var(--radius) var(--r) var(--r); + border-radius: var(--radius-small); } diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 8a15b505..8147077c 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -6,6 +6,7 @@ import { Author } from "./Author" import { Spacer } from "../Spacer" import { Contacts } from "../Contacts" import { Box } from "@/ui/Box" +import { Panel } from "@/ui/Panel" export type FooterProps = { showAuthor: boolean @@ -14,10 +15,18 @@ export type FooterProps = { export const Footer: React.FC = ({ showAuthor, children }) => (