Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bicstone committed Jun 17, 2023
1 parent 5c58eb8 commit 12b5307
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 106 deletions.
17 changes: 13 additions & 4 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ import dotenv from "dotenv";

import { SITE_METADATA } from "./src/constants/SITE_METADATA";

import type {
GatsbyPluginSitemapQuery,
GatsbyPluginFeedQuery,
} from "@/generated/graphqlTypes";
import type Sentry from "@sentry/browser";
import type { GatsbyConfig } from "gatsby";

import {
type GatsbyPluginSitemapQuery,
type GatsbyPluginFeedQuery,
} from "@/generated/graphqlTypes";
// Google Tag Manager types
declare global {
interface Window {
Sentry?: typeof Sentry;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
adsbygoogle?: any;
}
}

dotenv.config({ path: `.env` });

Expand Down
File renamed without changes.
9 changes: 0 additions & 9 deletions src/layouts/WrapRootElement.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { CustomThemeProvider } from "./themes";

import type Sentry from "@sentry/browser";
import type { ReactNode } from "react";

interface WrapRootElementProps {
children: ReactNode;
}

declare global {
interface Window {
Sentry?: typeof Sentry;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
adsbygoogle?: any;
}
}

/**
* WrapRootElement
* This is useful to set up any Provider components that will wrap your application.
Expand Down
9 changes: 4 additions & 5 deletions src/layouts/themes/CustomThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { ThemeProvider as EmotionThemeProvider, Global } from "@emotion/react";
import CssBaseline from "@mui/material/CssBaseline";
import { Experimental_CssVarsProvider as CssVarsProvider } from "@mui/material/styles/CssVarsProvider";

import { useTheme, type CustomTheme } from "./useTheme";
import { useTheme } from "./useTheme";

import type { Theme as MuiTheme } from "@mui/material/styles";
import type { ReactNode } from "react";

import type {} from "@mui/material/themeCssVarsAugmentation";

import { FONT_FAMILY } from "@/components/markdown/constants";

// emotion types
declare module "@emotion/react" {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Theme extends CustomTheme {}
export interface Theme extends MuiTheme {}
}

interface CustomThemeProviderProps {
Expand Down
176 changes: 88 additions & 88 deletions src/layouts/themes/M3Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,94 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

import type { ThemeOptions } from "@mui/material/styles";

interface M3Tone {
0: string;
10: string;
20: string;
30: string;
40: string;
50: string;
60: string;
70: string;
80: string;
90: string;
95: string;
99: string;
100: string;
}
export interface M3ThemeTones {
primary: M3Tone;
secondary: M3Tone;
tertiary: M3Tone;
neutral: M3Tone;
neutralVariant: M3Tone;
error: M3Tone;
}

export interface M3ColorTokens {
primary: string;
onPrimary: string;

primaryContainer: string;
onPrimaryContainer: string;

secondary: string;
onSecondary: string;

secondaryContainer: string;
onSecondaryContainer: string;

tertiary: string;
onTertiary: string;

tertiaryContainer: string;
onTertiaryContainer: string;

error: string;
onError: string;

errorContainer: string;
onErrorContainer: string;

background: string;
onBackground: string;

surface: string;
onSurface: string;

surfaceVariant: string;
onSurfaceVariant: string;

inverseSurface: string;
inverseOnSurface: string;

inversePrimary: string;
surfaceTint?: string;

outline: string;
shadow: string;

primary085Lighten: string;
primary080Darken: string;
primary090Lighten: string;
primary090Darken: string;
primaryContainer008Lighten: string;
primaryContainer008Darken: string;
secondaryContainer008Lighten: string;
secondaryContainer008Darken: string;
tertiaryContainer008Lighten: string;
tertiaryContainer008Darken: string;
}

export type M3ThemeMode = "dark" | "light";

export interface M3ThemeScheme {
light: M3ColorTokens;
dark: M3ColorTokens;
tones?: M3ThemeTones;
}
import type { PaletteColor, ThemeOptions } from "@mui/material/styles";

declare module "@mui/material/styles" {
interface Palette {
Expand Down Expand Up @@ -209,6 +122,93 @@ declare module "@mui/material/Fab" {
}
}

interface M3Tone {
0: string;
10: string;
20: string;
30: string;
40: string;
50: string;
60: string;
70: string;
80: string;
90: string;
95: string;
99: string;
100: string;
}
export interface M3ThemeTones {
primary: M3Tone;
secondary: M3Tone;
tertiary: M3Tone;
neutral: M3Tone;
neutralVariant: M3Tone;
error: M3Tone;
}

export interface M3ColorTokens {
primary: string;
onPrimary: string;

primaryContainer: string;
onPrimaryContainer: string;

secondary: string;
onSecondary: string;

secondaryContainer: string;
onSecondaryContainer: string;

tertiary: string;
onTertiary: string;

tertiaryContainer: string;
onTertiaryContainer: string;

error: string;
onError: string;

errorContainer: string;
onErrorContainer: string;

background: string;
onBackground: string;

surface: string;
onSurface: string;

surfaceVariant: string;
onSurfaceVariant: string;

inverseSurface: string;
inverseOnSurface: string;

inversePrimary: string;
surfaceTint?: string;

outline: string;
shadow: string;

primary085Lighten: string;
primary080Darken: string;
primary090Lighten: string;
primary090Darken: string;
primaryContainer008Lighten: string;
primaryContainer008Darken: string;
secondaryContainer008Lighten: string;
secondaryContainer008Darken: string;
tertiaryContainer008Lighten: string;
tertiaryContainer008Darken: string;
}

export type M3ThemeMode = "dark" | "light";

export interface M3ThemeScheme {
light: M3ColorTokens;
dark: M3ColorTokens;
tones?: M3ThemeTones;
}

export const getDesignTokens = (
mode: M3ThemeMode,
scheme: M3ColorTokens,
Expand Down
3 changes: 3 additions & 0 deletions src/layouts/themes/useTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import type { CssVarsTheme, Theme } from "@mui/material/styles";

import { FONT_FAMILY } from "@/components/markdown/constants";

// css vars types
import type { } from "@mui/material/themeCssVarsAugmentation";

export type CustomTheme = Omit<Theme, "palette"> & CssVarsTheme;

export const useTheme = (): CustomTheme => {
Expand Down

0 comments on commit 12b5307

Please sign in to comment.