diff --git a/app/client/src/components/editorComponents/Button.tsx b/app/client/src/components/editorComponents/Button.tsx index 9bc902093a..d4141a538b 100644 --- a/app/client/src/components/editorComponents/Button.tsx +++ b/app/client/src/components/editorComponents/Button.tsx @@ -1,5 +1,9 @@ import React from "react"; -import { Intent, BlueprintButtonIntentsCSS } from "constants/DefaultTheme"; +import { + Intent, + BlueprintButtonIntentsCSS, + Skin, +} from "constants/DefaultTheme"; import styled, { css } from "styled-components"; import { AnchorButton as BlueprintAnchorButton, @@ -21,7 +25,7 @@ const buttonStyles = css<{ intent?: Intent; filled?: string; fluid?: boolean; - skin?: string; + skin?: Skin; iconAlignment?: Direction; }>` ${BlueprintButtonIntentsCSS} @@ -38,23 +42,19 @@ const buttonStyles = css<{ } &&&&&& { &.bp3-button span { - font-weight: ${props => (props.skin ? 400 : 700)}; + font-weight: ${props => (props.skin !== undefined ? 400 : 700)}; } .bp3-icon svg { - width: ${props => (props.skin ? 14 : 16)}px; - height: ${props => (props.skin ? 14 : 16)}px; + width: ${props => (props.skin !== undefined ? 14 : 16)}px; + height: ${props => (props.skin !== undefined ? 14 : 16)}px; } &.bp3-button { display: flex; width: 100%; justify-content: ${props => - props.skin !== undefined - ? props.iconAlignment === Directions.RIGHT - ? "space-between" - : props.iconAlignment === Directions.LEFT - ? "flex-start" - : "" - : ""}; + props.iconAlignment === Directions.RIGHT + ? "space-between" + : "flex-start"}; } } ${props => (props.outline ? outline : "")} @@ -63,7 +63,7 @@ const StyledButton = styled(BlueprintButton)<{ outline?: string; intent?: Intent; filled?: string; - skin?: string; + skin?: Skin; iconAlignment?: Direction; }>` ${buttonStyles} @@ -72,7 +72,7 @@ const StyledAnchorButton = styled(BlueprintAnchorButton)<{ outline?: string; intent?: Intent; filled?: string; - skin?: string; + skin?: Skin; iconAlignment?: Direction; }>` ${buttonStyles} @@ -93,7 +93,7 @@ export type ButtonProps = { type?: "button" | "submit" | "reset"; className?: string; fluid?: boolean; - skin?: string; + skin?: Skin; }; export const Button = (props: ButtonProps) => { @@ -121,7 +121,7 @@ export const Button = (props: ButtonProps) => { type: props.type, className: props.className, fluid: props.fluid ? props.fluid.toString() : undefined, - skin: props.skin ? props.skin : undefined, + skin: props.skin, iconAlignment: props.iconAlignment ? props.iconAlignment : undefined, }; if (props.href) { diff --git a/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx b/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx index 549cb8d457..51e1660e1f 100644 --- a/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx +++ b/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx @@ -19,7 +19,7 @@ import { WrappedFieldInputProps, WrappedFieldMetaProps } from "redux-form"; import _ from "lodash"; import { parseDynamicString } from "utils/DynamicBindingUtils"; import { DataTree } from "entities/DataTree/dataTreeFactory"; -import { Theme } from "constants/DefaultTheme"; +import { Theme, Skin } from "constants/DefaultTheme"; import AnalyticsUtil from "utils/AnalyticsUtil"; import TernServer from "utils/autocomplete/TernServer"; import KeyboardShortcuts from "constants/KeyboardShortcuts"; @@ -581,7 +581,7 @@ class DynamicAutocompleteInput extends Component { {showLightningMenu !== false && ( }> diff --git a/app/client/src/components/editorComponents/LightningMenu/helpers.tsx b/app/client/src/components/editorComponents/LightningMenu/helpers.tsx index 8e386ef1ec..bd9858e5a3 100644 --- a/app/client/src/components/editorComponents/LightningMenu/helpers.tsx +++ b/app/client/src/components/editorComponents/LightningMenu/helpers.tsx @@ -20,9 +20,10 @@ import { LIGHTNING_MENU_QUERY_CREATE_NEW, LIGHTNING_MENU_API_CREATE_NEW, } from "constants/messages"; +import { Skin } from "constants/DefaultTheme"; export const getApiOptions = ( - skin: string, + skin: Skin, apis: RestAction[], pageId: string, dispatch: Function, @@ -66,7 +67,7 @@ export const getApiOptions = ( }); export const getQueryOptions = ( - skin: string, + skin: Skin, queries: RestAction[], pageId: string, dispatch: Function, @@ -110,7 +111,7 @@ export const getQueryOptions = ( }); export const getWidgetOptions = ( - skin: string, + skin: Skin, widgets: WidgetProps[], updateDynamicInputValue: (value: string, cursor?: number) => void, ) => ({ @@ -140,7 +141,7 @@ export const getLightningMenuOptions = ( widgets: WidgetProps[], pageId: string, dispatch: Function, - skin: string, + skin: Skin, updateDynamicInputValue: (value: string, cursor?: number) => void, ) => { const options: CustomizedDropdownOption[] = [ diff --git a/app/client/src/components/editorComponents/LightningMenu/index.tsx b/app/client/src/components/editorComponents/LightningMenu/index.tsx index a93b5407cd..bd89e938fe 100644 --- a/app/client/src/components/editorComponents/LightningMenu/index.tsx +++ b/app/client/src/components/editorComponents/LightningMenu/index.tsx @@ -12,13 +12,13 @@ import { LIGHTNING_MENU_DATA_TOOLTIP } from "constants/messages"; import { getLightningMenuOptions } from "./helpers"; import { useActions, useWidgets, usePageId } from "./hooks"; -import { Theme } from "constants/DefaultTheme"; +import { Theme, Skin } from "constants/DefaultTheme"; import { withTheme } from "styled-components"; import { useDispatch } from "react-redux"; const LightningIcon = ControlIcons.LIGHTNING_CONTROL; const lightningMenuOptions = ( - skin: string, + skin: Skin, apis: RestAction[], queries: RestAction[], widgets: WidgetProps[], @@ -58,7 +58,7 @@ const lightningMenuOptions = ( type LightningMenuProps = { onSelect?: (value: string) => void; updateDynamicInputValue: (value: string, cursor?: number) => void; - skin: string; + skin: Skin; theme: Theme; }; @@ -71,7 +71,7 @@ export const LightningMenu = (props: LightningMenuProps) => { ); diff --git a/app/client/src/constants/DefaultTheme.tsx b/app/client/src/constants/DefaultTheme.tsx index be52b49be5..a2d105a0f9 100644 --- a/app/client/src/constants/DefaultTheme.tsx +++ b/app/client/src/constants/DefaultTheme.tsx @@ -37,6 +37,11 @@ export const IntentIcons: Record> = { warning: AlertIcons.WARNING, }; +export enum Skin { + LIGHT, + DARK, +} + export const BlueprintControlTransform = css` && { .${Classes.CONTROL} { @@ -264,13 +269,13 @@ export type Theme = { hoverBGOpacity: number; }; dropdown: { - light: { + [Skin.LIGHT]: { hoverBG: Color; hoverText: Color; inActiveBG: Color; inActiveText: Color; }; - dark: { + [Skin.DARK]: { hoverBG: Color; hoverText: Color; inActiveBG: Color; @@ -296,8 +301,8 @@ export type Theme = { alert: Record; lightningMenu: { iconSize: number; - dark: { color: Color }; - light: { color: Color }; + [Skin.DARK]: { color: Color }; + [Skin.LIGHT]: { color: Color }; }; }; @@ -425,13 +430,13 @@ export const theme: Theme = { hoverBGOpacity: 0.5, }, dropdown: { - light: { + [Skin.LIGHT]: { hoverBG: Colors.GREEN, hoverText: Colors.WHITE, inActiveBG: Colors.WHITE, inActiveText: Colors.BLACK_PEARL, }, - dark: { + [Skin.DARK]: { hoverBG: Colors.TROUT_DARK, hoverText: Colors.WHITE, inActiveBG: Colors.BLUE_CHARCOAL, @@ -475,10 +480,10 @@ export const theme: Theme = { }, lightningMenu: { iconSize: 14, - dark: { + [Skin.DARK]: { color: Colors.WHITE, }, - light: { + [Skin.LIGHT]: { color: Colors.HIT_GRAY, }, }, diff --git a/app/client/src/pages/Editor/EditorHeader.tsx b/app/client/src/pages/Editor/EditorHeader.tsx index d52d1274b3..2d190b5269 100644 --- a/app/client/src/pages/Editor/EditorHeader.tsx +++ b/app/client/src/pages/Editor/EditorHeader.tsx @@ -20,6 +20,7 @@ import { getOnSelectAction, } from "pages/common/CustomizedDropdown/dropdownHelpers"; import AnalyticsUtil from "utils/AnalyticsUtil"; +import { Skin } from "constants/DefaultTheme"; const LoadingContainer = styled.div` display: flex; @@ -79,8 +80,8 @@ export const EditorHeader = (props: EditorHeaderProps) => {