Skip to content
Snippets Groups Projects
Unverified Commit e430b776 authored by Denis Berezin's avatar Denis Berezin Committed by GitHub
Browse files

feat(sdk): SDK theming part 4 - danger, dark, error, filter, focus, saturated, shadow (#43608)

* Migrate danger

* Migrate dark

* Migrate error

* Migrate filter

* Migrate focus

* Migrate saturated

* Migrate shadow

* Fix CI

* Fix CI

* Fix CI
parent 0ade074b
No related branches found
No related tags found
No related merge requests found
Showing
with 40 additions and 43 deletions
...@@ -14,5 +14,6 @@ ...@@ -14,5 +14,6 @@
--mb-color-border: #eeecec; --mb-color-border: #eeecec;
--mb-color-brand-light: #f9fbfc; --mb-color-brand-light: #f9fbfc;
--mb-color-brand-lighter: #eef6fc; --mb-color-brand-lighter: #eef6fc;
--mb-color-filter: #7172ad;
} }
</style> </style>
...@@ -53,6 +53,9 @@ const SdkContentWrapperInner = styled.div< ...@@ -53,6 +53,9 @@ const SdkContentWrapperInner = styled.div<
--mb-color-text-dark: ${({ theme }) => theme.fn.themeColor("text-dark")}; --mb-color-text-dark: ${({ theme }) => theme.fn.themeColor("text-dark")};
--mb-color-text-medium: ${({ theme }) => theme.fn.themeColor("text-medium")}; --mb-color-text-medium: ${({ theme }) => theme.fn.themeColor("text-medium")};
--mb-color-text-light: ${({ theme }) => theme.fn.themeColor("text-light")}; --mb-color-text-light: ${({ theme }) => theme.fn.themeColor("text-light")};
--mb-color-danger: ${({ theme }) => theme.fn.themeColor("danger")};
--mb-color-error: ${({ theme }) => theme.fn.themeColor("error")};
--mb-color-filter: ${({ theme }) => theme.fn.themeColor("filter")};
--mb-color-bg-error: ${() => color("bg-error")}; --mb-color-bg-error: ${() => color("bg-error")};
--mb-color-bg-medium: ${({ theme }) => theme.fn.themeColor("bg-medium")}; --mb-color-bg-medium: ${({ theme }) => theme.fn.themeColor("bg-medium")};
--mb-color-bg-night: ${() => color("bg-night")}; --mb-color-bg-night: ${() => color("bg-night")};
......
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import Input from "metabase/core/components/Input"; import Input from "metabase/core/components/Input";
import { color } from "metabase/lib/colors";
export const SessionTimeoutSettingRoot = styled.div` export const SessionTimeoutSettingRoot = styled.div`
margin: 0.5rem 0; margin: 0.5rem 0;
...@@ -31,5 +30,5 @@ export const SessionTimeoutInput = styled(Input)<SessionTimeoutInputProps>` ...@@ -31,5 +30,5 @@ export const SessionTimeoutInput = styled(Input)<SessionTimeoutInputProps>`
export const ErrorMessage = styled.div` export const ErrorMessage = styled.div`
text-align: right; text-align: right;
margin-top: 0.5rem; margin-top: 0.5rem;
color: ${color("error")}; color: var(--mb-color-error);
`; `;
...@@ -10,7 +10,7 @@ export const CacheTTLFieldContainer = styled.div` ...@@ -10,7 +10,7 @@ export const CacheTTLFieldContainer = styled.div`
`; `;
export const FieldText = styled.span<{ hasError?: boolean; margin: string }>` export const FieldText = styled.span<{ hasError?: boolean; margin: string }>`
color: ${props => color(props.hasError ? "error" : "text-dark")}; color: ${props => (props.hasError ? color("error") : color("text-dark"))};
${props => css`margin-${props.margin}: 10px;`} ${props => css`margin-${props.margin}: 10px;`}
`; `;
...@@ -18,7 +18,7 @@ export const Input = styled(NumericInput)` ...@@ -18,7 +18,7 @@ export const Input = styled(NumericInput)`
width: 50px; width: 50px;
text-align: center; text-align: center;
color: ${props => color(props.hasError ? "error" : "text-dark")}; color: ${props => (props.hasError ? color("error") : color("text-dark"))};
font-weight: bold; font-weight: bold;
padding: 0.75em; padding: 0.75em;
......
import { css } from "@emotion/react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import type { FormSubmitButtonProps } from "metabase/forms"; import type { FormSubmitButtonProps } from "metabase/forms";
...@@ -7,8 +8,12 @@ import { alpha } from "metabase/lib/colors"; ...@@ -7,8 +8,12 @@ import { alpha } from "metabase/lib/colors";
export const ResetAllFormSubmitButton = styled(FormSubmitButton, { export const ResetAllFormSubmitButton = styled(FormSubmitButton, {
shouldForwardProp: prop => prop !== "highlightOnHover", shouldForwardProp: prop => prop !== "highlightOnHover",
})<FormSubmitButtonProps & { highlightOnHover?: boolean }>` })<FormSubmitButtonProps & { highlightOnHover?: boolean }>`
${({ highlightOnHover }) => ${({ highlightOnHover, theme }) =>
highlightOnHover highlightOnHover
? `:hover { background-color: ${alpha("error", 0.15)}; }` ? css`
:hover {
background-color: ${alpha(theme.fn.themeColor("error"), 0.15)};
}
`
: ""} : ""}
`; `;
...@@ -4,7 +4,7 @@ import { color } from "metabase/lib/colors"; ...@@ -4,7 +4,7 @@ import { color } from "metabase/lib/colors";
export const ChangeTypeButton = styled.button` export const ChangeTypeButton = styled.button`
padding: 0 0.25rem; padding: 0 0.25rem;
color: ${color("filter")}; color: var(--mb-color-filter);
cursor: pointer; cursor: pointer;
vertical-align: middle; vertical-align: middle;
`; `;
......
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { color } from "metabase/lib/colors";
export const UserTypeToggleRoot = styled.button` export const UserTypeToggleRoot = styled.button`
padding: 0 0.5rem; padding: 0 0.5rem;
color: ${color("filter")}; color: var(--mb-color-filter);
cursor: pointer; cursor: pointer;
vertical-align: middle; vertical-align: middle;
`; `;
...@@ -38,6 +38,6 @@ export const IconButton = styled(Button)` ...@@ -38,6 +38,6 @@ export const IconButton = styled(Button)`
&:hover { &:hover {
background-color: transparent; background-color: transparent;
color: ${color("danger")}; color: var(--mb-color-danger);
} }
`; `;
import { css } from "@emotion/react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import Button from "metabase/core/components/Button"; import Button from "metabase/core/components/Button";
import { color } from "metabase/lib/colors";
export const StyledButton = styled(Button)<{ export const StyledButton = styled(Button)<{
isFullHeight?: boolean; isFullHeight?: boolean;
...@@ -12,9 +12,9 @@ export const StyledButton = styled(Button)<{ ...@@ -12,9 +12,9 @@ export const StyledButton = styled(Button)<{
${({ focus }) => ${({ focus }) =>
focus focus
? ` ? css`
border: 2px solid ${color("focus")}; border: 2px solid var(--mb-color-focus);
` `
: ""} : ""}
`; `;
......
...@@ -22,7 +22,7 @@ export const AddMorePrompt = styled.div<{ isVisible: boolean }>` ...@@ -22,7 +22,7 @@ export const AddMorePrompt = styled.div<{ isVisible: boolean }>`
export const ErrorMessage = styled.div` export const ErrorMessage = styled.div`
text-align: center; text-align: center;
font-size: 0.875rem; font-size: 0.875rem;
color: ${color("error")}; color: var(--mb-color-error);
`; `;
export const TextArea = styled.textarea` export const TextArea = styled.textarea`
......
...@@ -25,7 +25,7 @@ export const Description = styled.p` ...@@ -25,7 +25,7 @@ export const Description = styled.p`
`; `;
export const Error = styled(Description)` export const Error = styled(Description)`
color: ${color("error")}; color: var(--mb-color-error);
border-left: 3px solid ${color("error")}; border-left: 3px solid var(--mb-color-error);
padding-left: 12px; padding-left: 12px;
`; `;
...@@ -33,6 +33,6 @@ export const FeatureDescriptionText = styled.p` ...@@ -33,6 +33,6 @@ export const FeatureDescriptionText = styled.p`
export const ErrorMessage = styled.p` export const ErrorMessage = styled.p`
width: 80%; width: 80%;
color: ${color("error")}; color: var(--mb-color-error);
line-height: 1.5rem; line-height: 1.5rem;
`; `;
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { color } from "metabase/lib/colors";
export const DeleteDatabaseModalRoot = styled.form` export const DeleteDatabaseModalRoot = styled.form`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -35,7 +33,7 @@ export const DeleteDatabaseModalSection = styled.div<DeleteDatabaseModalSectionP ...@@ -35,7 +33,7 @@ export const DeleteDatabaseModalSection = styled.div<DeleteDatabaseModalSectionP
`; `;
export const ErrorMessage = styled.div` export const ErrorMessage = styled.div`
color: ${color("error")}; color: var(--mb-color-error);
padding: 0 1rem; padding: 0 1rem;
`; `;
......
...@@ -5,6 +5,6 @@ import { alpha } from "metabase/lib/colors"; ...@@ -5,6 +5,6 @@ import { alpha } from "metabase/lib/colors";
export const FieldListGroupingTrigger = styled.div` export const FieldListGroupingTrigger = styled.div`
display: flex; display: flex;
visibility: hidden; visibility: hidden;
border-left: 2px solid ${alpha("filter", 0.1)}; border-left: 2px solid ${() => alpha("filter", 0.1)};
color: ${alpha("text-white", 0.5)}; color: ${alpha("text-white", 0.5)};
`; `;
import { css } from "@emotion/react"; import { css } from "@emotion/react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { color } from "metabase/lib/colors";
export interface FilterWidgetRootProps { export interface FilterWidgetRootProps {
isSelected: boolean; isSelected: boolean;
} }
...@@ -16,7 +14,7 @@ export const FilterWidgetRoot = styled.div<FilterWidgetRootProps>` ...@@ -16,7 +14,7 @@ export const FilterWidgetRoot = styled.div<FilterWidgetRootProps>`
${({ isSelected }) => ${({ isSelected }) =>
isSelected && isSelected &&
css` css`
border-color: ${color("filter")}; border-color: var(--mb-color-filter);
`} `}
`; `;
...@@ -35,7 +33,7 @@ export const FilterSection = styled.div` ...@@ -35,7 +33,7 @@ export const FilterSection = styled.div`
`; `;
export const FilterField = styled(FilterSection)` export const FilterField = styled(FilterSection)`
color: ${color("filter")}; color: var(--mb-color-filter);
font-weight: 700; font-weight: 700;
&:hover { &:hover {
...@@ -43,14 +41,14 @@ export const FilterField = styled(FilterSection)` ...@@ -43,14 +41,14 @@ export const FilterField = styled(FilterSection)`
} }
${QueryOption} { ${QueryOption} {
color: ${color("filter")}; color: var(--mb-color-filter);
} }
`; `;
export const FilterOperator = styled(FilterSection)` export const FilterOperator = styled(FilterSection)`
color: ${color("filter")}; color: var(--mb-color-filter);
${QueryOption} { ${QueryOption} {
color: ${color("filter")}; color: var(--mb-color-filter);
} }
`; `;
...@@ -13,6 +13,6 @@ export const AmPmLabel = styled.span<AmPmLabelProps>` ...@@ -13,6 +13,6 @@ export const AmPmLabel = styled.span<AmPmLabelProps>`
cursor: ${props => !props.isSelected && "pointer"}; cursor: ${props => !props.isSelected && "pointer"};
&:hover { &:hover {
color: ${color("filter")}; color: var(--mb-color-filter);
} }
`; `;
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import NumericInput from "metabase/components/NumericInput"; import NumericInput from "metabase/components/NumericInput";
import { color } from "metabase/lib/colors";
export const IntervalInput = styled(NumericInput)` export const IntervalInput = styled(NumericInput)`
border-color: ${color("filter")}; border-color: var(--mb-color-filter);
`; `;
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { color } from "metabase/lib/colors";
export const TimeLabel = styled.div` export const TimeLabel = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: ${color("filter")}; color: var(--mb-color-filter);
} }
`; `;
...@@ -12,7 +12,7 @@ export const SelectPickerButton = styled.button<SelectPickerButtonProps>` ...@@ -12,7 +12,7 @@ export const SelectPickerButton = styled.button<SelectPickerButtonProps>`
font-weight: 700; font-weight: 700;
width: 100%; width: 100%;
height: 95px; height: 95px;
border: 1px solid ${color("filter")}; border: 1px solid var(--mb-color-filter);
border-radius: 0.5rem; border-radius: 0.5rem;
background-color: ${props => background-color: ${props =>
props.isSelected ? color("filter") : color("white")}; props.isSelected ? color("filter") : color("white")};
......
...@@ -2,19 +2,17 @@ import { css } from "@emotion/react"; ...@@ -2,19 +2,17 @@ import { css } from "@emotion/react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import AutosizeTextarea from "react-textarea-autosize"; import AutosizeTextarea from "react-textarea-autosize";
import { color } from "metabase/lib/colors";
export interface TextPickerInputProps { export interface TextPickerInputProps {
hasInvalidValues: boolean; hasInvalidValues: boolean;
} }
export const TextPickerInput = styled.input<TextPickerInputProps>` export const TextPickerInput = styled.input<TextPickerInputProps>`
border-color: ${color("filter")}; border-color: var(--mb-color-filter);
${({ hasInvalidValues }) => ${({ hasInvalidValues }) =>
hasInvalidValues && hasInvalidValues &&
css` css`
border-color: ${color("error")}; border-color: var(--mb-color-error);
`} `}
`; `;
...@@ -23,11 +21,11 @@ export interface TextPickerAreaProps { ...@@ -23,11 +21,11 @@ export interface TextPickerAreaProps {
} }
export const TextPickerArea = styled(AutosizeTextarea)<TextPickerAreaProps>` export const TextPickerArea = styled(AutosizeTextarea)<TextPickerAreaProps>`
border-color: ${color("filter")}; border-color: var(--mb-color-filter);
${({ hasInvalidValues }) => ${({ hasInvalidValues }) =>
hasInvalidValues && hasInvalidValues &&
css` css`
border-color: ${color("error")}; border-color: var(--mb-color-error);
`} `}
`; `;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment