Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,028 changes: 2,264 additions & 1,764 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/react-plotly.js": "^2.2.4",
"@types/react-router-dom": "^5.1.5",
"@types/sinon": "7.0.6",
"@types/styled-components": "^5.1.34",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
Expand Down
11 changes: 6 additions & 5 deletions src/components/CustomButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TOOLTIP_DELAY,
} from "../../constants";
import { ButtonClass, TooltipPlacement } from "../../constants/interfaces";
import { ThemedProps } from "../../styles/theme/theme";

interface CustomButtonProps extends Omit<AntButtonProps, "type" | "variant"> {
variant?: ButtonClass;
Expand All @@ -26,7 +27,7 @@ interface TooltipButtonProps extends CustomButtonProps {
tooltipPlacement?: TooltipPlacement;
}

const baseStyles = css`
const baseStyles = css<ThemedProps>`
font-family: ${(props) => props.theme.typography};
border-radius: 3px;
height: 32px;
Expand All @@ -46,7 +47,7 @@ const baseStyles = css`
const generateButtonStyles = (
variant: "primary" | "secondary",
theme: "light" | "dark"
) => css`
) => css<ThemedProps>`
${({
theme: {
colors: { button },
Expand Down Expand Up @@ -84,7 +85,7 @@ const generateButtonStyles = (
}}
`;

const actionStyles = css`
const actionStyles = css<ThemedProps>`
${({
theme: {
colors: {
Expand Down Expand Up @@ -115,15 +116,15 @@ const actionStyles = css`
`}
`;

const variantStyles: Record<ButtonClass, RuleSet<object>> = {
const variantStyles: Record<ButtonClass, RuleSet<ThemedProps>> = {
[ButtonClass.LightPrimary]: generateButtonStyles("primary", "light"),
[ButtonClass.LightSecondary]: generateButtonStyles("secondary", "light"),
[ButtonClass.DarkPrimary]: generateButtonStyles("primary", "dark"),
[ButtonClass.DarkSecondary]: generateButtonStyles("secondary", "dark"),
[ButtonClass.Action]: actionStyles,
};

const StyledButton = styled(AntButton)<CustomButtonProps>`
const StyledButton = styled(AntButton)<CustomButtonProps & ThemedProps>`
${baseStyles}
${({ variant = ButtonClass.LightPrimary }) => variantStyles[variant]}
`;
Expand Down
9 changes: 5 additions & 4 deletions src/components/CustomDropdown/DropdownMenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { Link, LinkProps } from "react-router-dom";
import styled, { css } from "styled-components";
import { ArrowRight } from "../Icons";
import { ThemedProps, ThemeType } from "../../styles/theme/theme";

// Dropdown items can be of a few component
// varieties, including buttons, router links, and
Expand All @@ -10,7 +11,7 @@ import { ArrowRight } from "../Icons";
// for semantically explicit usage in dropdowns.

// Common styles
const baseStyles = css`
const baseStyles = css<{ theme: ThemeType }>`
font-family: ${(props) => props.theme.typography};
background: none;
border: 2px solid ${({ theme }) => theme.colors.dropdown.background};
Expand Down Expand Up @@ -62,17 +63,17 @@ const contentStyles = css`
`;

// Styled components
const StyledDropdownButton = styled.button`
const StyledDropdownButton = styled.button<ThemedProps>`
${baseStyles}
${contentStyles}
`;

const StyledRouterLink = styled(Link)`
const StyledRouterLink = styled(Link)<ThemedProps>`
${baseStyles}
${contentStyles}
`;

const StyledExternalLink = styled.a`
const StyledExternalLink = styled.a<ThemedProps>`
${baseStyles}
${contentStyles}
`;
Expand Down
4 changes: 4 additions & 0 deletions src/styles/theme/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const componentColors = {
light: {
background: baseColors.dark.five,
text: baseColors.gray.six,
border: baseColors.dark.five,
hover: {
background: semanticColors.darkActiveBg,
text: semanticColors.primaryPurple,
Expand All @@ -113,6 +114,7 @@ export const componentColors = {
dark: {
background: semanticColors.primaryPurple,
text: baseColors.dark.three,
border: semanticColors.primaryPurple,
hover: {
background: semanticColors.activePurple,
text: semanticColors.lightBgActiveText,
Expand All @@ -139,6 +141,7 @@ export const componentColors = {
light: {
background: semanticColors.transparentBg,
text: baseColors.dark.five,
border: semanticColors.transparentBg,
hover: {
background: baseColors.dark.one,
text: semanticColors.primaryPurple,
Expand Down Expand Up @@ -188,6 +191,7 @@ export const componentColors = {
text: semanticColors.primaryPurple,
hover: {
text: semanticColors.activePurple,
background: semanticColors.lightPurpleBg,
},
active: {
text: semanticColors.activePurple,
Expand Down
8 changes: 5 additions & 3 deletions src/styles/theme/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ThemeConfig } from "antd";
import { DefaultTheme } from "styled-components";
import { themeColors } from "./colors";

const typographyToken = {
Expand All @@ -10,10 +9,13 @@ const typographyToken = {
// make variables available as props in
// .styled components by passing this into
// the ThemeProvider in the StyleProvider
export const styledTheme: DefaultTheme = {
export const styledTheme = {
colors: themeColors,
typography: typographyToken.fontFamily,
};
} as const;

export type ThemeType = typeof styledTheme;
export type ThemedProps<T = unknown> = T & { theme: ThemeType };

export const antdTheme: ThemeConfig = {
token: {
Expand Down