Skip to content

Commit

Permalink
Merge pull request #71 from saleor/fix-deep-imports
Browse files Browse the repository at this point in the history
Fix deep imports
  • Loading branch information
dominik-zeglen committed Oct 18, 2021
2 parents b7db1ec + a170e0b commit 24125a4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
6 changes: 4 additions & 2 deletions src/theme/createSaleorTheme/overrides/buttons.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { ThemeOptions } from "@material-ui/core/styles";
import { darken, fade } from "@material-ui/core/styles";
import type { Overrides } from "@material-ui/core/styles/overrides";

import { SaleorThemeColors } from "../types";

export const buttonOverrides = (colors: SaleorThemeColors): Overrides => ({
export const buttonOverrides = (
colors: SaleorThemeColors
): ThemeOptions["overrides"] => ({
MuiButton: {
contained: {
"&$disabled": {
Expand Down
4 changes: 2 additions & 2 deletions src/theme/createSaleorTheme/overrides/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Overrides } from "@material-ui/core/styles/overrides";
import type { ThemeOptions } from "@material-ui/core/styles";

import { SaleorThemeColors } from "../types";
import { buttonOverrides } from "./buttons";
Expand All @@ -8,7 +8,7 @@ import { tableOverrides } from "./tables";
export const overrides = (
colors: SaleorThemeColors,
fontFamily: string
): Overrides => ({
): ThemeOptions["overrides"] => ({
...inputOverrides(colors),
...tableOverrides(colors, fontFamily),
...buttonOverrides(colors),
Expand Down
7 changes: 4 additions & 3 deletions src/theme/createSaleorTheme/overrides/inputs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { fade } from "@material-ui/core/styles";
import type { Overrides } from "@material-ui/core/styles/overrides";
import { fade, ThemeOptions } from "@material-ui/core/styles";

import { SaleorThemeColors } from "../types";

export const inputOverrides = (colors: SaleorThemeColors): Overrides => ({
export const inputOverrides = (
colors: SaleorThemeColors
): ThemeOptions["overrides"] => ({
MuiInput: {
input: {
"&:-webkit-autofill": {
Expand Down
5 changes: 2 additions & 3 deletions src/theme/createSaleorTheme/overrides/tables.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { fade } from "@material-ui/core/styles";
import type { Overrides } from "@material-ui/core/styles/overrides";
import { fade, ThemeOptions } from "@material-ui/core/styles";

import { SaleorThemeColors } from "../types";

export const tableOverrides = (
colors: SaleorThemeColors,
fontFamily: string
): Overrides => ({
): ThemeOptions["overrides"] => ({
MuiTable: {
root: {
fontFamily,
Expand Down
4 changes: 2 additions & 2 deletions src/theme/createSaleorTheme/shadows.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Shadows } from "@material-ui/core/styles/shadows";
import type { ThemeOptions } from "@material-ui/core/styles";

const createShadow = (
pv: number,
Expand All @@ -17,7 +17,7 @@ const createShadow = (
`0 ${av}px ${ab}px ${as}px rgba(0, 0, 0, 0.12)`,
].join(",");

export const shadows: Shadows = [
export const shadows: ThemeOptions["shadows"] = [
"none",
createShadow(1, 1, 0, 2, 1, -2, 1, 3, 0),
createShadow(2, 2, 0, 3, 1, -2, 1, 5, 0),
Expand Down
14 changes: 4 additions & 10 deletions src/theme/createSaleorTheme/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
/* eslint-disable @typescript-eslint/unified-signatures */
import type { Theme } from "@material-ui/core/styles";
import type { ThemeOptions } from "@material-ui/core/styles/createMuiTheme";
import type {
Palette,
PaletteOptions,
} from "@material-ui/core/styles/createPalette";
import type { Theme, ThemeOptions } from "@material-ui/core/styles";

export type AlertPalette = Record<
"success" | "error" | "warning" | "info",
Expand All @@ -20,11 +15,10 @@ interface ExtraPalette {
}
type ExtraPaletteOptions = Partial<ExtraPalette>;

export interface SaleorPalette extends Palette, ExtraPalette {}
export type SaleorPalette = Theme["palette"] & ExtraPalette;

export interface SaleorPaletteOptions
extends PaletteOptions,
ExtraPaletteOptions {}
export type SaleorPaletteOptions = ThemeOptions["palette"] &
ExtraPaletteOptions;

export interface SaleorSpacing {
(): string;
Expand Down

1 comment on commit 24125a4

@vercel
Copy link

@vercel vercel bot commented on 24125a4 Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.