Add 's' method to access theme props (#5163)

This commit is contained in:
Tom Moor
2023-04-07 22:43:34 -04:00
committed by GitHub
parent c202198d61
commit 422bdc32d9
116 changed files with 482 additions and 388 deletions

View File

@@ -1,5 +1,6 @@
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
export const Action = styled(Flex)` export const Action = styled(Flex)`
@@ -20,7 +21,7 @@ export const Separator = styled.div`
margin-left: 12px; margin-left: 12px;
width: 1px; width: 1px;
height: 28px; height: 28px;
background: ${(props) => props.theme.divider}; background: ${s("divider")};
`; `;
const Actions = styled(Flex)` const Actions = styled(Flex)`
@@ -29,8 +30,8 @@ const Actions = styled(Flex)`
right: 0; right: 0;
left: 0; left: 0;
border-radius: 3px; border-radius: 3px;
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
padding: 12px; padding: 12px;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);

View File

@@ -1,5 +1,6 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import useBoolean from "~/hooks/useBoolean"; import useBoolean from "~/hooks/useBoolean";
import Initials from "./Initials"; import Initials from "./Initials";
@@ -63,8 +64,8 @@ const IconWrapper = styled.div`
position: absolute; position: absolute;
bottom: -2px; bottom: -2px;
right: -2px; right: -2px;
background: ${(props) => props.theme.accent}; background: ${s("accent")};
border: 2px solid ${(props) => props.theme.background}; border: 2px solid ${s("background")};
border-radius: 100%; border-radius: 100%;
width: 20px; width: 20px;
height: 20px; height: 20px;

View File

@@ -2,6 +2,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import User from "~/models/User"; import User from "~/models/User";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
import Tooltip from "~/components/Tooltip"; import Tooltip from "~/components/Tooltip";
@@ -106,7 +107,7 @@ const AvatarWrapper = styled.div<AvatarWrapperProps>`
&:hover:after { &:hover:after {
border: 2px solid ${(props) => props.$color}; border: 2px solid ${(props) => props.$color};
box-shadow: inset 0 0 0 2px ${(props) => props.theme.background}; box-shadow: inset 0 0 0 2px ${s("background")};
} }
`} `}
`; `;

View File

@@ -1,7 +1,7 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import env from "~/env"; import env from "~/env";
import OutlineIcon from "./Icons/OutlineIcon"; import OutlineIcon from "./Icons/OutlineIcon";
@@ -26,16 +26,16 @@ const Link = styled.a`
font-size: 14px; font-size: 14px;
text-decoration: none; text-decoration: none;
border-top-right-radius: 2px; border-top-right-radius: 2px;
color: ${(props) => props.theme.text}; color: ${s("text")};
display: flex; display: flex;
align-items: center; align-items: center;
svg { svg {
fill: ${(props) => props.theme.text}; fill: ${s("text")};
} }
&:hover { &:hover {
background: ${(props) => props.theme.sidebarBackground}; background: ${s("sidebarBackground")};
} }
${breakpoint("tablet")` ${breakpoint("tablet")`

View File

@@ -2,9 +2,9 @@ import { GoToIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s, ellipsis } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import BreadcrumbMenu from "~/menus/BreadcrumbMenu"; import BreadcrumbMenu from "~/menus/BreadcrumbMenu";
import { ellipsis } from "~/styles";
import { MenuInternalLink } from "~/types"; import { MenuInternalLink } from "~/types";
type Props = { type Props = {
@@ -61,7 +61,7 @@ function Breadcrumb({
const Slash = styled(GoToIcon)` const Slash = styled(GoToIcon)`
flex-shrink: 0; flex-shrink: 0;
fill: ${(props) => props.theme.divider}; fill: ${s("divider")};
`; `;
const Item = styled(Link)<{ $highlight: boolean; $withIcon: boolean }>` const Item = styled(Link)<{ $highlight: boolean; $withIcon: boolean }>`
@@ -70,7 +70,7 @@ const Item = styled(Link)<{ $highlight: boolean; $withIcon: boolean }>`
flex-shrink: 1; flex-shrink: 1;
min-width: 0; min-width: 0;
cursor: var(--pointer); cursor: var(--pointer);
color: ${(props) => props.theme.text}; color: ${s("text")};
font-size: 15px; font-size: 15px;
height: 24px; height: 24px;
font-weight: ${(props) => (props.$highlight ? "500" : "inherit")}; font-weight: ${(props) => (props.$highlight ? "500" : "inherit")};

View File

@@ -3,6 +3,7 @@ import { ExpandedIcon } from "outline-icons";
import { darken, lighten, transparentize } from "polished"; import { darken, lighten, transparentize } from "polished";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import ActionButton, { import ActionButton, {
Props as ActionButtonProps, Props as ActionButtonProps,
} from "~/components/ActionButton"; } from "~/components/ActionButton";
@@ -22,8 +23,8 @@ const RealButton = styled(ActionButton)<RealProps>`
margin: 0; margin: 0;
padding: 0; padding: 0;
border: 0; border: 0;
background: ${(props) => props.theme.accent}; background: ${s("accent")};
color: ${(props) => props.theme.accentText}; color: ${s("accentText")};
box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 2px; box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 2px;
border-radius: 4px; border-radius: 4px;
font-size: 14px; font-size: 14px;

View File

@@ -4,6 +4,7 @@ import { transparentize } from "polished";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Collection from "~/models/Collection"; import Collection from "~/models/Collection";
import Arrow from "~/components/Arrow"; import Arrow from "~/components/Arrow";
import ButtonLink from "~/components/ButtonLink"; import ButtonLink from "~/components/ButtonLink";
@@ -141,7 +142,7 @@ function CollectionDescription({ collection }: Props) {
const Disclosure = styled(NudeButton)` const Disclosure = styled(NudeButton)`
opacity: 0; opacity: 0;
color: ${(props) => props.theme.divider}; color: ${s("divider")};
position: absolute; position: absolute;
top: calc(25vh - 50px); top: calc(25vh - 50px);
left: 50%; left: 50%;
@@ -155,12 +156,12 @@ const Disclosure = styled(NudeButton)`
} }
&:active { &:active {
color: ${(props) => props.theme.sidebarText}; color: ${s("sidebarText")};
} }
`; `;
const Placeholder = styled(ButtonLink)` const Placeholder = styled(ButtonLink)`
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
cursor: text; cursor: text;
min-height: 27px; min-height: 27px;
`; `;
@@ -193,7 +194,7 @@ const Input = styled.div`
margin: -8px; margin: -8px;
padding: 8px; padding: 8px;
border-radius: 8px; border-radius: 8px;
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
&:after { &:after {
content: ""; content: "";
@@ -206,7 +207,7 @@ const Input = styled.div`
background: linear-gradient( background: linear-gradient(
180deg, 180deg,
${(props) => transparentize(1, props.theme.background)} 0%, ${(props) => transparentize(1, props.theme.background)} 0%,
${(props) => props.theme.background} 100% ${s("background")} 100%
); );
} }
@@ -218,7 +219,7 @@ const Input = styled.div`
} }
&[data-editing="true"] { &[data-editing="true"] {
background: ${(props) => props.theme.secondaryBackground}; background: ${s("secondaryBackground")};
} }
.block-menu-trigger, .block-menu-trigger,

View File

@@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
import { Portal } from "react-portal"; import { Portal } from "react-portal";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import CommandBarResults from "~/components/CommandBarResults"; import CommandBarResults from "~/components/CommandBarResults";
import SearchActions from "~/components/SearchActions"; import SearchActions from "~/components/SearchActions";
import rootActions from "~/actions/root"; import rootActions from "~/actions/root";
@@ -73,12 +73,12 @@ const SearchInput = styled(KBarSearch)`
width: 100%; width: 100%;
outline: none; outline: none;
border: none; border: none;
background: ${(props) => props.theme.menuBackground}; background: ${s("menuBackground")};
color: ${(props) => props.theme.text}; color: ${s("text")};
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
} }
`; `;
@@ -86,8 +86,8 @@ const Animator = styled(KBarAnimator)`
max-width: 600px; max-width: 600px;
max-height: 75vh; max-height: 75vh;
width: 90vw; width: 90vw;
background: ${(props) => props.theme.menuBackground}; background: ${s("menuBackground")};
color: ${(props) => props.theme.text}; color: ${s("text")};
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
box-shadow: rgb(0 0 0 / 40%) 0px 16px 60px; box-shadow: rgb(0 0 0 / 40%) 0px 16px 60px;

View File

@@ -2,9 +2,9 @@ import { ActionImpl } from "kbar";
import { ArrowIcon, BackIcon } from "outline-icons"; import { ArrowIcon, BackIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import styled, { css, useTheme } from "styled-components"; import styled, { css, useTheme } from "styled-components";
import { s, ellipsis } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import Key from "~/components/Key"; import Key from "~/components/Key";
import { ellipsis } from "~/styles";
type Props = { type Props = {
action: ActionImpl; action: ActionImpl;
@@ -77,12 +77,12 @@ const Icon = styled(Flex)`
justify-content: center; justify-content: center;
width: 24px; width: 24px;
height: 24px; height: 24px;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
flex-shrink: 0; flex-shrink: 0;
`; `;
const Ancestor = styled.span` const Ancestor = styled.span`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
`; `;
const Content = styled(Flex)` const Content = styled(Flex)`

View File

@@ -1,6 +1,7 @@
import { useMatches, KBarResults } from "kbar"; import { useMatches, KBarResults } from "kbar";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import CommandBarItem from "~/components/CommandBarItem"; import CommandBarItem from "~/components/CommandBarItem";
export default function CommandBarResults() { export default function CommandBarResults() {
@@ -30,6 +31,6 @@ const Header = styled.h3`
letter-spacing: 0.04em; letter-spacing: 0.04em;
margin: 0; margin: 0;
padding: 16px 0 4px 20px; padding: 16px 0 4px 20px;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
height: 36px; height: 36px;
`; `;

View File

@@ -1,6 +1,7 @@
import isPrintableKeyEvent from "is-printable-key-event"; import isPrintableKeyEvent from "is-printable-key-event";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import useOnScreen from "~/hooks/useOnScreen"; import useOnScreen from "~/hooks/useOnScreen";
type Props = Omit<React.HTMLAttributes<HTMLSpanElement>, "ref" | "onChange"> & { type Props = Omit<React.HTMLAttributes<HTMLSpanElement>, "ref" | "onChange"> & {
@@ -166,10 +167,10 @@ function placeCaret(element: HTMLElement, atStart: boolean) {
} }
const Content = styled.span` const Content = styled.span`
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
color: ${(props) => props.theme.text}; color: ${s("text")};
-webkit-text-fill-color: ${(props) => props.theme.text}; -webkit-text-fill-color: ${s("text")};
outline: none; outline: none;
resize: none; resize: none;
cursor: text; cursor: text;
@@ -180,8 +181,8 @@ const Content = styled.span`
&:empty::before { &:empty::before {
display: inline-block; display: inline-block;
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
-webkit-text-fill-color: ${(props) => props.theme.placeholder}; -webkit-text-fill-color: ${s("placeholder")};
content: attr(data-placeholder); content: attr(data-placeholder);
pointer-events: none; pointer-events: none;
height: 0; height: 0;

View File

@@ -1,10 +1,11 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
const Header = styled.h3` const Header = styled.h3`
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
color: ${(props) => props.theme.sidebarText}; color: ${s("sidebarText")};
letter-spacing: 0.04em; letter-spacing: 0.04em;
margin: 1em 12px 0.5em; margin: 1em 12px 0.5em;
`; `;

View File

@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
import { Menu, MenuStateReturn } from "reakit/Menu"; import { Menu, MenuStateReturn } from "reakit/Menu";
import styled, { DefaultTheme } from "styled-components"; import styled, { DefaultTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import Scrollable from "~/components/Scrollable"; import Scrollable from "~/components/Scrollable";
import useMenuContext from "~/hooks/useMenuContext"; import useMenuContext from "~/hooks/useMenuContext";
import useMenuHeight from "~/hooks/useMenuHeight"; import useMenuHeight from "~/hooks/useMenuHeight";
@@ -171,7 +171,7 @@ export const Backdrop = styled.div`
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background: ${(props) => props.theme.backdrop}; background: ${s("backdrop")};
z-index: ${depths.menu - 1}; z-index: ${depths.menu - 1};
`; `;
@@ -203,7 +203,7 @@ export const Background = styled(Scrollable)<BackgroundProps>`
animation: ${mobileContextMenu} 200ms ease; animation: ${mobileContextMenu} 200ms ease;
transform-origin: 50% 100%; transform-origin: 50% 100%;
max-width: 100%; max-width: 100%;
background: ${(props) => props.theme.menuBackground}; background: ${s("menuBackground")};
border-radius: 6px; border-radius: 6px;
padding: 6px; padding: 6px;
min-width: 180px; min-width: 180px;

View File

@@ -1,8 +1,9 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
const Divider = styled.hr` const Divider = styled.hr`
border: 0; border: 0;
border-bottom: 1px solid ${(props) => props.theme.divider}; border-bottom: 1px solid ${s("divider")};
margin: 0; margin: 0;
padding: 0; padding: 0;
`; `;

View File

@@ -7,13 +7,13 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled, { useTheme } from "styled-components"; import styled, { useTheme } from "styled-components";
import { s, ellipsis } from "@shared/styles";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Pin from "~/models/Pin"; import Pin from "~/models/Pin";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import NudeButton from "~/components/NudeButton"; import NudeButton from "~/components/NudeButton";
import Time from "~/components/Time"; import Time from "~/components/Time";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import { ellipsis } from "~/styles";
import CollectionIcon from "./Icons/CollectionIcon"; import CollectionIcon from "./Icons/CollectionIcon";
import EmojiIcon from "./Icons/EmojiIcon"; import EmojiIcon from "./Icons/EmojiIcon";
import Squircle from "./Squircle"; import Squircle from "./Squircle";
@@ -165,9 +165,9 @@ const AnimatePresence = styled(m.div)`
`; `;
const Fold = styled.svg` const Fold = styled.svg`
fill: ${(props) => props.theme.background}; fill: ${s("background")};
stroke: ${(props) => props.theme.inputBorder}; stroke: ${s("inputBorder")};
background: ${(props) => props.theme.background}; background: ${s("background")};
position: absolute; position: absolute;
top: -1px; top: -1px;
@@ -175,11 +175,11 @@ const Fold = styled.svg`
`; `;
const PinButton = styled(NudeButton)` const PinButton = styled(NudeButton)`
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
&:hover, &:hover,
&:active { &:active {
color: ${(props) => props.theme.text}; color: ${s("text")};
} }
`; `;
@@ -189,7 +189,7 @@ const Actions = styled(Flex)`
right: ${(props) => (props.dir === "rtl" ? "auto" : "4px")}; right: ${(props) => (props.dir === "rtl" ? "auto" : "4px")};
left: ${(props) => (props.dir === "rtl" ? "4px" : "auto")}; left: ${(props) => (props.dir === "rtl" ? "4px" : "auto")};
opacity: 0; opacity: 0;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
// move actions above content // move actions above content
z-index: 2; z-index: 2;
@@ -222,7 +222,7 @@ const DocumentMeta = styled(Text)`
display: flex; display: flex;
align-items: center; align-items: center;
gap: 2px; gap: 2px;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
margin: 0 0 0 -2px; margin: 0 0 0 -2px;
`; `;
@@ -236,9 +236,9 @@ const DocumentLink = styled(Link)<{
height: 100%; height: 100%;
border-radius: 8px; border-radius: 8px;
cursor: var(--pointer); cursor: var(--pointer);
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: transform 50ms ease-in-out; transition: transform 50ms ease-in-out;
border: 1px solid ${(props) => props.theme.inputBorder}; border: 1px solid ${s("inputBorder")};
border-bottom-width: 2px; border-bottom-width: 2px;
border-right-width: 2px; border-right-width: 2px;
@@ -275,7 +275,7 @@ const Heading = styled.h3`
max-height: 66px; // 3*line-height max-height: 66px; // 3*line-height
overflow: hidden; overflow: hidden;
color: ${(props) => props.theme.text}; color: ${s("text")};
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
`; `;

View File

@@ -3,10 +3,10 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s, ellipsis } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import Disclosure from "~/components/Sidebar/components/Disclosure"; import Disclosure from "~/components/Sidebar/components/Disclosure";
import Text from "~/components/Text"; import Text from "~/components/Text";
import { ellipsis } from "~/styles";
type Props = { type Props = {
selected: boolean; selected: boolean;
@@ -98,7 +98,7 @@ export const Node = styled.span<{
overflow: hidden; overflow: hidden;
font-size: 16px; font-size: 16px;
width: ${(props) => props.style.width}; width: ${(props) => props.style.width};
color: ${(props) => props.theme.text}; color: ${s("text")};
cursor: var(--pointer); cursor: var(--pointer);
padding: 12px; padding: 12px;
border-radius: 6px; border-radius: 6px;

View File

@@ -3,10 +3,10 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import scrollIntoView from "smooth-scroll-into-view-if-needed"; import scrollIntoView from "smooth-scroll-into-view-if-needed";
import styled from "styled-components"; import styled from "styled-components";
import { ellipsis } from "@shared/styles";
import { Node as SearchResult } from "~/components/DocumentExplorerNode"; import { Node as SearchResult } from "~/components/DocumentExplorerNode";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import Text from "~/components/Text"; import Text from "~/components/Text";
import { ellipsis } from "~/styles";
type Props = { type Props = {
selected: boolean; selected: boolean;

View File

@@ -6,6 +6,7 @@ import { Link } from "react-router-dom";
import { CompositeStateReturn, CompositeItem } from "reakit/Composite"; import { CompositeStateReturn, CompositeItem } from "reakit/Composite";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Badge from "~/components/Badge"; import Badge from "~/components/Badge";
import Button from "~/components/Button"; import Button from "~/components/Button";
@@ -181,7 +182,7 @@ const Actions = styled(EventBoundary)`
${NudeButton} { ${NudeButton} {
&:hover, &:hover,
&[aria-expanded="true"] { &[aria-expanded="true"] {
background: ${(props) => props.theme.sidebarControlHoverBackground}; background: ${s("sidebarControlHoverBackground")};
} }
} }
@@ -223,7 +224,7 @@ const DocumentLink = styled(Link)<{
&:active, &:active,
&:focus, &:focus,
&:focus-within { &:focus-within {
background: ${(props) => props.theme.listItemHoverBackground}; background: ${s("listItemHoverBackground")};
${Actions} { ${Actions} {
opacity: 1; opacity: 1;
@@ -241,7 +242,7 @@ const DocumentLink = styled(Link)<{
${(props) => ${(props) =>
props.$menuOpen && props.$menuOpen &&
css` css`
background: ${(props) => props.theme.listItemHoverBackground}; background: ${s("listItemHoverBackground")};
${Actions} { ${Actions} {
opacity: 1; opacity: 1;
@@ -262,7 +263,7 @@ const Heading = styled.h3<{ rtl?: boolean }>`
margin-bottom: 0.25em; margin-bottom: 0.25em;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
color: ${(props) => props.theme.text}; color: ${s("text")};
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
`; `;
@@ -280,7 +281,7 @@ const Title = styled(Highlight)`
const ResultContext = styled(Highlight)` const ResultContext = styled(Highlight)`
display: block; display: block;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
font-size: 14px; font-size: 14px;
margin-top: -0.25em; margin-top: -0.25em;
margin-bottom: 0.25em; margin-bottom: 0.25em;

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s, ellipsis } from "@shared/styles";
import Document from "~/models/Document"; import Document from "~/models/Document";
import DocumentBreadcrumb from "~/components/DocumentBreadcrumb"; import DocumentBreadcrumb from "~/components/DocumentBreadcrumb";
import DocumentTasks from "~/components/DocumentTasks"; import DocumentTasks from "~/components/DocumentTasks";
@@ -11,7 +12,6 @@ import Flex from "~/components/Flex";
import Time from "~/components/Time"; import Time from "~/components/Time";
import useCurrentUser from "~/hooks/useCurrentUser"; import useCurrentUser from "~/hooks/useCurrentUser";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import { ellipsis } from "~/styles";
type Props = { type Props = {
showCollection?: boolean; showCollection?: boolean;
@@ -185,7 +185,7 @@ const DocumentMeta: React.FC<Props> = ({
const Container = styled(Flex)<{ rtl?: boolean }>` const Container = styled(Flex)<{ rtl?: boolean }>`
justify-content: ${(props) => (props.rtl ? "flex-end" : "flex-start")}; justify-content: ${(props) => (props.rtl ? "flex-end" : "flex-start")};
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
font-size: 13px; font-size: 13px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@@ -1,7 +1,8 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
const Empty = styled.p` const Empty = styled.p`
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
user-select: none; user-select: none;
`; `;

View File

@@ -3,6 +3,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { withTranslation, Trans, WithTranslation } from "react-i18next"; import { withTranslation, Trans, WithTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { githubIssuesUrl, feedbackUrl } from "@shared/utils/urlHelpers"; import { githubIssuesUrl, feedbackUrl } from "@shared/utils/urlHelpers";
import Button from "~/components/Button"; import Button from "~/components/Button";
import CenteredContent from "~/components/CenteredContent"; import CenteredContent from "~/components/CenteredContent";
@@ -137,7 +138,7 @@ class ErrorBoundary extends React.Component<Props> {
} }
const Pre = styled.pre` const Pre = styled.pre`
background: ${(props) => props.theme.secondaryBackground}; background: ${s("secondaryBackground")};
padding: 16px; padding: 16px;
border-radius: 4px; border-radius: 4px;
font-size: 12px; font-size: 12px;

View File

@@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import { CompositeStateReturn } from "reakit/Composite"; import { CompositeStateReturn } from "reakit/Composite";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Event from "~/models/Event"; import Event from "~/models/Event";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
@@ -197,7 +198,7 @@ const ItemStyle = css`
left: 23px; left: 23px;
width: 2px; width: 2px;
height: calc(100% + 8px); height: calc(100% + 8px);
background: ${(props) => props.theme.textSecondary}; background: ${s("textSecondary")};
opacity: 0.25; opacity: 0.25;
} }

View File

@@ -1,6 +1,7 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import User from "~/models/User"; import User from "~/models/User";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
@@ -59,8 +60,8 @@ const More = styled.div<{ size: number }>`
height: ${(props) => props.size}px; height: ${(props) => props.size}px;
border-radius: 100%; border-radius: 100%;
background: ${(props) => props.theme.slate}; background: ${(props) => props.theme.slate};
color: ${(props) => props.theme.text}; color: ${s("text")};
border: 2px solid ${(props) => props.theme.background}; border: 2px solid ${s("background")};
text-align: center; text-align: center;
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;

View File

@@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import { useMenuState, MenuButton } from "reakit/Menu"; import { useMenuState, MenuButton } from "reakit/Menu";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Button, { Inner } from "~/components/Button"; import Button, { Inner } from "~/components/Button";
import ContextMenu from "~/components/ContextMenu"; import ContextMenu from "~/components/ContextMenu";
import MenuItem from "~/components/ContextMenu/MenuItem"; import MenuItem from "~/components/ContextMenu/MenuItem";
@@ -80,7 +81,7 @@ const Note = styled(Text)`
line-height: 1.2em; line-height: 1.2em;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
`; `;
const LabelWithNote = styled.div` const LabelWithNote = styled.div`

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { MAX_AVATAR_DISPLAY } from "@shared/constants"; import { MAX_AVATAR_DISPLAY } from "@shared/constants";
import { s } from "@shared/styles";
import CollectionGroupMembership from "~/models/CollectionGroupMembership"; import CollectionGroupMembership from "~/models/CollectionGroupMembership";
import Group from "~/models/Group"; import Group from "~/models/Group";
import GroupMembers from "~/scenes/GroupMembers"; import GroupMembers from "~/scenes/GroupMembers";
@@ -81,7 +82,7 @@ const Image = styled(Flex)`
justify-content: center; justify-content: center;
width: 32px; width: 32px;
height: 32px; height: 32px;
background: ${(props) => props.theme.secondaryBackground}; background: ${s("secondaryBackground")};
border-radius: 32px; border-radius: 32px;
`; `;

View File

@@ -1,7 +1,7 @@
import * as React from "react"; import * as React from "react";
import { Dialog, DialogBackdrop, useDialogState } from "reakit/Dialog"; import { Dialog, DialogBackdrop, useDialogState } from "reakit/Dialog";
import styled from "styled-components"; import styled from "styled-components";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import Scrollable from "~/components/Scrollable"; import Scrollable from "~/components/Scrollable";
import usePrevious from "~/hooks/usePrevious"; import usePrevious from "~/hooks/usePrevious";
@@ -71,7 +71,7 @@ const Backdrop = styled.div`
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: ${(props) => props.theme.backdrop} !important; background-color: ${s("backdrop")} !important;
z-index: ${depths.modalOverlay}; z-index: ${depths.modalOverlay};
transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out;
opacity: 0; opacity: 0;
@@ -92,8 +92,8 @@ const Scene = styled.div`
justify-content: center; justify-content: center;
align-items: flex-start; align-items: flex-start;
width: 350px; width: 350px;
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
border-radius: 8px; border-radius: 8px;
outline: none; outline: none;
opacity: 0; opacity: 0;

View File

@@ -5,7 +5,7 @@ import { transparentize } from "polished";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import Button from "~/components/Button"; import Button from "~/components/Button";
import Fade from "~/components/Fade"; import Fade from "~/components/Fade";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
@@ -113,7 +113,7 @@ const Wrapper = styled(Flex)<WrapperProps>`
top: 0; top: 0;
z-index: ${depths.header}; z-index: ${depths.header};
position: sticky; position: sticky;
background: ${(props) => props.theme.background}; background: ${s("background")};
${(props) => ${(props) =>
props.$passThrough props.$passThrough

View File

@@ -2,6 +2,7 @@ import { escapeRegExp } from "lodash";
import * as React from "react"; import * as React from "react";
import replace from "string-replace-to-array"; import replace from "string-replace-to-array";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
type Props = React.HTMLAttributes<HTMLSpanElement> & { type Props = React.HTMLAttributes<HTMLSpanElement> & {
highlight: (string | null | undefined) | RegExp; highlight: (string | null | undefined) | RegExp;
@@ -43,7 +44,7 @@ function Highlight({
} }
export const Mark = styled.mark` export const Mark = styled.mark`
background: ${(props) => props.theme.searchHighlight}; background: ${s("searchHighlight")};
border-radius: 2px; border-radius: 2px;
padding: 0 2px; padding: 0 2px;
`; `;

View File

@@ -2,7 +2,7 @@ import { transparentize } from "polished";
import * as React from "react"; import * as React from "react";
import { Portal } from "react-portal"; import { Portal } from "react-portal";
import styled from "styled-components"; import styled from "styled-components";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import parseDocumentSlug from "@shared/utils/parseDocumentSlug"; import parseDocumentSlug from "@shared/utils/parseDocumentSlug";
import { isExternalUrl } from "@shared/utils/urls"; import { isExternalUrl } from "@shared/utils/urls";
import HoverPreviewDocument from "~/components/HoverPreviewDocument"; import HoverPreviewDocument from "~/components/HoverPreviewDocument";
@@ -163,7 +163,7 @@ const CardContent = styled.div`
// &:after — gradient mask for overflow text // &:after — gradient mask for overflow text
const Card = styled.div` const Card = styled.div`
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
background: ${(props) => props.theme.background}; background: ${s("background")};
border-radius: 4px; border-radius: 4px;
box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3),
0 0 1px 1px rgba(0, 0, 0, 0.05); 0 0 1px 1px rgba(0, 0, 0, 0.05);
@@ -186,13 +186,13 @@ const Card = styled.div`
90deg, 90deg,
${(props) => transparentize(1, props.theme.background)} 0%, ${(props) => transparentize(1, props.theme.background)} 0%,
${(props) => transparentize(1, props.theme.background)} 75%, ${(props) => transparentize(1, props.theme.background)} 75%,
${(props) => props.theme.background} 90% ${s("background")} 90%
); );
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
height: 1.7em; height: 1.7em;
border-bottom: 16px solid ${(props) => props.theme.background}; border-bottom: 16px solid ${s("background")};
border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
} }
@@ -236,7 +236,7 @@ const Pointer = styled.div<{ offset: number }>`
&:after { &:after {
border: 7px solid transparent; border: 7px solid transparent;
border-bottom-color: ${(props) => props.theme.background}; border-bottom-color: ${s("background")};
} }
`; `;

View File

@@ -2,6 +2,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import parseDocumentSlug from "@shared/utils/parseDocumentSlug"; import parseDocumentSlug from "@shared/utils/parseDocumentSlug";
import DocumentMeta from "~/components/DocumentMeta"; import DocumentMeta from "~/components/DocumentMeta";
import Editor from "~/components/Editor"; import Editor from "~/components/Editor";
@@ -52,7 +53,7 @@ const Content = styled(Link)`
const Heading = styled.h2` const Heading = styled.h2`
margin: 0 0 0.75em; margin: 0 0 0.75em;
color: ${(props) => props.theme.text}; color: ${s("text")};
`; `;
export default observer(HoverPreviewDocument); export default observer(HoverPreviewDocument);

View File

@@ -40,6 +40,7 @@ import { useTranslation } from "react-i18next";
import { useMenuState, MenuButton, MenuItem } from "reakit/Menu"; import { useMenuState, MenuButton, MenuItem } from "reakit/Menu";
import styled, { useTheme } from "styled-components"; import styled, { useTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import { colorPalette } from "@shared/utils/collections"; import { colorPalette } from "@shared/utils/collections";
import ContextMenu from "~/components/ContextMenu"; import ContextMenu from "~/components/ContextMenu";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
@@ -323,7 +324,7 @@ const Icons = styled.div`
`; `;
const Button = styled(NudeButton)` const Button = styled(NudeButton)`
border: 1px solid ${(props) => props.theme.inputBorder}; border: 1px solid ${s("inputBorder")};
width: 32px; width: 32px;
height: 32px; height: 32px;
`; `;

View File

@@ -2,9 +2,10 @@ import * as React from "react";
import { VisuallyHidden } from "reakit/VisuallyHidden"; import { VisuallyHidden } from "reakit/VisuallyHidden";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s, ellipsis } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import Text from "~/components/Text"; import Text from "~/components/Text";
import { ellipsis, undraggableOnDesktop } from "~/styles"; import { undraggableOnDesktop } from "~/styles";
const RealTextarea = styled.textarea<{ hasIcon?: boolean }>` const RealTextarea = styled.textarea<{ hasIcon?: boolean }>`
border: 0; border: 0;
@@ -12,11 +13,11 @@ const RealTextarea = styled.textarea<{ hasIcon?: boolean }>`
padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")}; padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")};
outline: none; outline: none;
background: none; background: none;
color: ${(props) => props.theme.text}; color: ${s("text")};
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
} }
`; `;
@@ -26,7 +27,7 @@ const RealInput = styled.input<{ hasIcon?: boolean }>`
padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")}; padding: 8px 12px 8px ${(props) => (props.hasIcon ? "8px" : "12px")};
outline: none; outline: none;
background: none; background: none;
color: ${(props) => props.theme.text}; color: ${s("text")};
height: 30px; height: 30px;
min-width: 0; min-width: 0;
${ellipsis()} ${ellipsis()}
@@ -34,14 +35,13 @@ const RealInput = styled.input<{ hasIcon?: boolean }>`
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
} }
&:-webkit-autofill, &:-webkit-autofill,
&:-webkit-autofill:hover, &:-webkit-autofill:hover,
&:-webkit-autofill:focus { &:-webkit-autofill:focus {
-webkit-box-shadow: 0 0 0px 1000px ${(props) => props.theme.background} -webkit-box-shadow: 0 0 0px 1000px ${s("background")} inset;
inset;
} }
&::-webkit-search-cancel-button { &::-webkit-search-cancel-button {
@@ -96,7 +96,7 @@ export const Outline = styled(Flex)<{
font-weight: normal; font-weight: normal;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
background: ${(props) => props.theme.background}; background: ${s("background")};
/* Prevents an issue where input placeholder appears in a selected style when double clicking title bar */ /* Prevents an issue where input placeholder appears in a selected style when double clicking title bar */
user-select: none; user-select: none;

View File

@@ -2,6 +2,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { MenuButton, useMenuState } from "reakit/Menu"; import { MenuButton, useMenuState } from "reakit/Menu";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import ContextMenu from "./ContextMenu"; import ContextMenu from "./ContextMenu";
import DelayedMount from "./DelayedMount"; import DelayedMount from "./DelayedMount";
import Input, { Props as InputProps } from "./Input"; import Input, { Props as InputProps } from "./Input";
@@ -60,7 +61,7 @@ const InputColor: React.FC<Props> = ({ value, onChange, ...rest }) => {
const SwatchButton = styled(NudeButton)<{ $background: string | undefined }>` const SwatchButton = styled(NudeButton)<{ $background: string | undefined }>`
background: ${(props) => props.$background}; background: ${(props) => props.$background};
border: 1px solid ${(props) => props.theme.inputBorder}; border: 1px solid ${s("inputBorder")};
border-radius: 50%; border-radius: 50%;
position: absolute; position: absolute;
bottom: 20px; bottom: 20px;
@@ -80,7 +81,7 @@ const StyledColorPicker = styled(ColorPicker)`
input { input {
user-select: text; user-select: text;
color: ${(props) => props.theme.text} !important; color: ${s("text")} !important;
} }
`; `;

View File

@@ -9,6 +9,7 @@ import { CheckmarkIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import { VisuallyHidden } from "reakit/VisuallyHidden"; import { VisuallyHidden } from "reakit/VisuallyHidden";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import Button, { Inner } from "~/components/Button"; import Button, { Inner } from "~/components/Button";
import Text from "~/components/Text"; import Text from "~/components/Text";
import useMenuHeight from "~/hooks/useMenuHeight"; import useMenuHeight from "~/hooks/useMenuHeight";
@@ -218,7 +219,7 @@ const Background = styled(ContextMenuBackground)`
`; `;
const Placeholder = styled.span` const Placeholder = styled.span`
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
`; `;
const Spacer = styled.div` const Spacer = styled.div`
@@ -236,7 +237,7 @@ const StyledButton = styled(Button)<{ nude?: boolean }>`
cursor: default; cursor: default;
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: ${(props) => props.theme.buttonNeutralBackground}; background: ${s("buttonNeutralBackground")};
} }
${(props) => ${(props) =>
@@ -276,7 +277,7 @@ const Positioner = styled(Position)`
${StyledSelectOption} { ${StyledSelectOption} {
&[aria-selected="true"] { &[aria-selected="true"] {
color: ${(props) => props.theme.white}; color: ${(props) => props.theme.white};
background: ${(props) => props.theme.accent}; background: ${s("accent")};
box-shadow: none; box-shadow: none;
cursor: var(--pointer); cursor: var(--pointer);

View File

@@ -1,6 +1,7 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
type Props = { type Props = {
@@ -18,7 +19,7 @@ export const Label = styled(Flex)`
font-weight: 500; font-weight: 500;
padding-bottom: 4px; padding-bottom: 4px;
display: inline-block; display: inline-block;
color: ${(props) => props.theme.text}; color: ${s("text")};
`; `;
export default observer(Labeled); export default observer(Labeled);

View File

@@ -5,7 +5,6 @@ import styled from "styled-components";
import { languages, languageOptions } from "@shared/i18n"; import { languages, languageOptions } from "@shared/i18n";
import ButtonLink from "~/components/ButtonLink"; import ButtonLink from "~/components/ButtonLink";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import NoticeTip from "~/components/NoticeTip";
import env from "~/env"; import env from "~/env";
import useCurrentUser from "~/hooks/useCurrentUser"; import useCurrentUser from "~/hooks/useCurrentUser";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
@@ -61,7 +60,7 @@ export default function LanguagePrompt() {
const appName = env.APP_NAME; const appName = env.APP_NAME;
return ( return (
<NoticeTip> <Wrapper>
<Flex align="center"> <Flex align="center">
<LanguageIcon /> <LanguageIcon />
<span> <span>
@@ -87,10 +86,28 @@ export default function LanguagePrompt() {
<Link onClick={ui.setLanguagePromptDismissed}>{t("Dismiss")}</Link> <Link onClick={ui.setLanguagePromptDismissed}>{t("Dismiss")}</Link>
</span> </span>
</Flex> </Flex>
</NoticeTip> </Wrapper>
); );
} }
const Wrapper = styled.p`
background: ${(props) => props.theme.brand.marine};
color: ${(props) => props.theme.almostBlack};
padding: 10px 12px;
margin-top: 24px;
border-radius: 4px;
position: relative;
a {
color: ${(props) => props.theme.almostBlack};
font-weight: 500;
}
a:hover {
text-decoration: underline;
}
`;
const Link = styled(ButtonLink)` const Link = styled(ButtonLink)`
color: ${(props) => props.theme.almostBlack}; color: ${(props) => props.theme.almostBlack};
font-weight: 500; font-weight: 500;

View File

@@ -3,6 +3,7 @@ import * as React from "react";
import { Helmet } from "react-helmet"; import { Helmet } from "react-helmet";
import styled, { DefaultTheme } from "styled-components"; import styled, { DefaultTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import { LoadingIndicatorBar } from "~/components/LoadingIndicator"; import { LoadingIndicatorBar } from "~/components/LoadingIndicator";
import SkipNavContent from "~/components/SkipNavContent"; import SkipNavContent from "~/components/SkipNavContent";
@@ -76,8 +77,8 @@ const Layout: React.FC<Props> = ({
}; };
const Container = styled(Flex)` const Container = styled(Flex)`
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
position: relative; position: relative;
width: 100%; width: 100%;
min-height: 100%; min-height: 100%;

View File

@@ -2,6 +2,7 @@ import { DisconnectedIcon, WarningIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Empty from "~/components/Empty"; import Empty from "~/components/Empty";
import useEventListener from "~/hooks/useEventListener"; import useEventListener from "~/hooks/useEventListener";
import { OfflineError } from "~/utils/errors"; import { OfflineError } from "~/utils/errors";
@@ -43,10 +44,10 @@ const Content = styled(Empty)`
white-space: nowrap; white-space: nowrap;
${ButtonLink} { ${ButtonLink} {
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
&:hover { &:hover {
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
text-decoration: underline; text-decoration: underline;
} }
} }

View File

@@ -1,9 +1,9 @@
import { LocationDescriptor } from "history"; import { LocationDescriptor } from "history";
import * as React from "react"; import * as React from "react";
import styled, { useTheme } from "styled-components"; import styled, { useTheme } from "styled-components";
import { s, ellipsis } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import NavLink from "~/components/NavLink"; import NavLink from "~/components/NavLink";
import { ellipsis } from "~/styles";
export type Props = Omit<React.HTMLAttributes<HTMLAnchorElement>, "title"> & { export type Props = Omit<React.HTMLAttributes<HTMLAnchorElement>, "title"> & {
image?: React.ReactNode; image?: React.ReactNode;
@@ -98,7 +98,7 @@ const Image = styled(Flex)`
user-select: none; user-select: none;
flex-shrink: 0; flex-shrink: 0;
align-self: center; align-self: center;
color: ${(props) => props.theme.text}; color: ${s("text")};
`; `;
const Heading = styled.p<{ $small?: boolean }>` const Heading = styled.p<{ $small?: boolean }>`

View File

@@ -1,6 +1,6 @@
import * as React from "react"; import * as React from "react";
import styled, { keyframes } from "styled-components"; import styled, { keyframes } from "styled-components";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
const LoadingIndicatorBar = () => { const LoadingIndicatorBar = () => {
return ( return (
@@ -28,7 +28,7 @@ const Container = styled.div`
const Loader = styled.div` const Loader = styled.div`
width: 100%; width: 100%;
height: 2px; height: 2px;
background-color: ${(props) => props.theme.accent}; background-color: ${s("accent")};
`; `;
export default LoadingIndicatorBar; export default LoadingIndicatorBar;

View File

@@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
import { Dialog, DialogBackdrop, useDialogState } from "reakit/Dialog"; import { Dialog, DialogBackdrop, useDialogState } from "reakit/Dialog";
import styled, { DefaultTheme } from "styled-components"; import styled, { DefaultTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import NudeButton from "~/components/NudeButton"; import NudeButton from "~/components/NudeButton";
import Scrollable from "~/components/Scrollable"; import Scrollable from "~/components/Scrollable";
@@ -171,8 +171,8 @@ const Fullscreen = styled.div<FullscreenProps>`
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: flex-start; align-items: flex-start;
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
outline: none; outline: none;
${breakpoint("tablet")` ${breakpoint("tablet")`
@@ -209,7 +209,7 @@ const Close = styled(NudeButton)`
right: 0; right: 0;
margin: 12px; margin: 12px;
opacity: 0.75; opacity: 0.75;
color: ${(props) => props.theme.text}; color: ${s("text")};
width: auto; width: auto;
height: auto; height: auto;
@@ -229,7 +229,7 @@ const Back = styled(NudeButton)`
top: ${Desktop.hasInsetTitlebar() ? "3rem" : "2rem"}; top: ${Desktop.hasInsetTitlebar() ? "3rem" : "2rem"};
left: 2rem; left: 2rem;
opacity: 0.75; opacity: 0.75;
color: ${(props) => props.theme.text}; color: ${s("text")};
font-weight: 500; font-weight: 500;
width: auto; width: auto;
height: auto; height: auto;
@@ -244,7 +244,7 @@ const Back = styled(NudeButton)`
`; `;
const Header = styled(Flex)` const Header = styled(Flex)`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-weight: 600; font-weight: 600;
@@ -262,16 +262,16 @@ const Small = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: flex-start; align-items: flex-start;
background: ${(props) => props.theme.modalBackground}; background: ${s("modalBackground")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
box-shadow: ${(props) => props.theme.modalShadow}; box-shadow: ${s("modalShadow")};
border-radius: 8px; border-radius: 8px;
outline: none; outline: none;
${NudeButton} { ${NudeButton} {
&:hover, &:hover,
&[aria-expanded="true"] { &[aria-expanded="true"] {
background: ${(props) => props.theme.sidebarControlHoverBackground}; background: ${s("sidebarControlHoverBackground")};
} }
vertical-align: middle; vertical-align: middle;
} }

View File

@@ -1,5 +1,6 @@
import React from "react"; import React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Flex from "./Flex"; import Flex from "./Flex";
import Text from "./Text"; import Text from "./Text";
@@ -33,8 +34,8 @@ const Title = styled.span`
`; `;
const Container = styled(Text)` const Container = styled(Text)`
background: ${(props) => props.theme.sidebarBackground}; background: ${s("sidebarBackground")};
color: ${(props) => props.theme.sidebarText}; color: ${s("sidebarText")};
padding: 10px 12px; padding: 10px 12px;
border-radius: 4px; border-radius: 4px;
position: relative; position: relative;

View File

@@ -1,7 +1,7 @@
import * as React from "react"; import * as React from "react";
import Notice from "~/components/Notice"; import Notice from "~/components/Notice";
const AlertNotice: React.FC = ({ children }) => { const NoticeAlert: React.FC = ({ children }) => {
return ( return (
<Notice> <Notice>
<svg <svg
@@ -26,4 +26,4 @@ const AlertNotice: React.FC = ({ children }) => {
); );
}; };
export default AlertNotice; export default NoticeAlert;

View File

@@ -1,21 +0,0 @@
import styled from "styled-components";
const Notice = styled.p`
background: ${(props) => props.theme.brand.marine};
color: ${(props) => props.theme.almostBlack};
padding: 10px 12px;
margin-top: 24px;
border-radius: 4px;
position: relative;
a {
color: ${(props) => props.theme.almostBlack};
font-weight: 500;
}
a:hover {
text-decoration: underline;
}
`;
export default Notice;

View File

@@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { randomInteger } from "@shared/random"; import { randomInteger } from "@shared/random";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import { pulsate } from "~/styles/animations"; import { pulsate } from "~/styles/animations";
@@ -30,7 +31,7 @@ const Mask = styled(Flex)<{
props.height ? props.height : props.header ? 24 : 18}px; props.height ? props.height : props.header ? 24 : 18}px;
margin-bottom: 6px; margin-bottom: 6px;
border-radius: 6px; border-radius: 6px;
background-color: ${(props) => props.theme.divider}; background-color: ${s("divider")};
animation: ${pulsate} 2s infinite; animation: ${pulsate} 2s infinite;
animation-delay: ${(props) => props.delay || 0}s; animation-delay: ${(props) => props.delay || 0}s;

View File

@@ -3,7 +3,7 @@ import { Dialog } from "reakit/Dialog";
import { Popover as ReakitPopover, PopoverProps } from "reakit/Popover"; import { Popover as ReakitPopover, PopoverProps } from "reakit/Popover";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import useMobile from "~/hooks/useMobile"; import useMobile from "~/hooks/useMobile";
import { fadeAndScaleIn } from "~/styles/animations"; import { fadeAndScaleIn } from "~/styles/animations";
@@ -42,13 +42,13 @@ const Popover: React.FC<Props> = ({
const Contents = styled.div<{ $shrink?: boolean; $width?: number }>` const Contents = styled.div<{ $shrink?: boolean; $width?: number }>`
animation: ${fadeAndScaleIn} 200ms ease; animation: ${fadeAndScaleIn} 200ms ease;
transform-origin: 75% 0; transform-origin: 75% 0;
background: ${(props) => props.theme.menuBackground}; background: ${s("menuBackground")};
border-radius: 6px; border-radius: 6px;
padding: ${(props) => (props.$shrink ? "6px 0" : "12px 24px")}; padding: ${(props) => (props.$shrink ? "6px 0" : "12px 24px")};
max-height: 75vh; max-height: 75vh;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
box-shadow: ${(props) => props.theme.menuShadow}; box-shadow: ${s("menuShadow")};
width: ${(props) => props.$width}px; width: ${(props) => props.$width}px;
${breakpoint("mobile", "tablet")` ${breakpoint("mobile", "tablet")`

View File

@@ -1,8 +1,8 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { hideScrollbars } from "@shared/styles";
import useWindowSize from "~/hooks/useWindowSize"; import useWindowSize from "~/hooks/useWindowSize";
import { hideScrollbars } from "~/styles";
type Props = React.HTMLAttributes<HTMLDivElement> & { type Props = React.HTMLAttributes<HTMLDivElement> & {
shadow?: boolean; shadow?: boolean;

View File

@@ -4,9 +4,10 @@ import { Link } from "react-router-dom";
import { CompositeItem } from "reakit/Composite"; import { CompositeItem } from "reakit/Composite";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s, ellipsis } from "@shared/styles";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Highlight, { Mark } from "~/components/Highlight"; import Highlight, { Mark } from "~/components/Highlight";
import { ellipsis, hover } from "~/styles"; import { hover } from "~/styles";
import { sharedDocumentPath } from "~/utils/routeHelpers"; import { sharedDocumentPath } from "~/utils/routeHelpers";
type Props = { type Props = {
@@ -101,13 +102,13 @@ const DocumentLink = styled(Link)<{
&:active, &:active,
&:focus, &:focus,
&:focus-within { &:focus-within {
background: ${(props) => props.theme.listItemHoverBackground}; background: ${s("listItemHoverBackground")};
} }
${(props) => ${(props) =>
props.$menuOpen && props.$menuOpen &&
css` css`
background: ${(props) => props.theme.listItemHoverBackground}; background: ${s("listItemHoverBackground")};
`} `}
`; `;
@@ -120,7 +121,7 @@ const Heading = styled.h4<{ rtl?: boolean }>`
margin-bottom: 0.25em; margin-bottom: 0.25em;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
color: ${(props) => props.theme.text}; color: ${s("text")};
`; `;
const Title = styled(Highlight)` const Title = styled(Highlight)`
@@ -134,7 +135,7 @@ const Title = styled(Highlight)`
const ResultContext = styled(Highlight)` const ResultContext = styled(Highlight)`
display: block; display: block;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
font-size: 14px; font-size: 14px;
margin-top: -0.25em; margin-top: -0.25em;
margin-bottom: 0.25em; margin-bottom: 0.25em;

View File

@@ -3,7 +3,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import styled, { useTheme } from "styled-components"; import styled, { useTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import ErrorBoundary from "~/components/ErrorBoundary"; import ErrorBoundary from "~/components/ErrorBoundary";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import ResizeBorder from "~/components/Sidebar/components/ResizeBorder"; import ResizeBorder from "~/components/Sidebar/components/ResizeBorder";
@@ -119,10 +119,9 @@ const Sidebar = styled(m.div)<{
}>` }>`
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
background: ${(props) => props.theme.background}; background: ${s("background")};
width: ${(props) => props.theme.sidebarRightWidth}px;
max-width: 70%; max-width: 70%;
border-left: 1px solid ${(props) => props.theme.divider}; border-left: 1px solid ${s("divider")};
transition: border-left 100ms ease-in-out; transition: border-left 100ms ease-in-out;
z-index: 1; z-index: 1;

View File

@@ -5,7 +5,7 @@ import { Portal } from "react-portal";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import styled, { useTheme } from "styled-components"; import styled, { useTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import useMenuContext from "~/hooks/useMenuContext"; import useMenuContext from "~/hooks/useMenuContext";
import usePrevious from "~/hooks/usePrevious"; import usePrevious from "~/hooks/usePrevious";
@@ -224,7 +224,7 @@ const Backdrop = styled.a`
right: 0; right: 0;
cursor: default; cursor: default;
z-index: ${depths.sidebar - 1}; z-index: ${depths.sidebar - 1};
background: ${(props) => props.theme.backdrop}; background: ${s("backdrop")};
`; `;
type ContainerProps = { type ContainerProps = {
@@ -239,9 +239,9 @@ const Container = styled(Flex)<ContainerProps>`
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
background: ${(props) => props.theme.sidebarBackground}; background: ${s("sidebarBackground")};
transition: box-shadow 100ms ease-in-out, transform 100ms ease-out, transition: box-shadow 100ms ease-in-out, transform 100ms ease-out,
${(props) => props.theme.backgroundTransition} ${s("backgroundTransition")}
${(props: ContainerProps) => ${(props: ContainerProps) =>
props.$isAnimating ? `,width ${ANIMATION_MS}ms ease-out` : ""}; props.$isAnimating ? `,width ${ANIMATION_MS}ms ease-out` : ""};
transform: translateX( transform: translateX(

View File

@@ -2,6 +2,7 @@ import { CollapsedIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import NudeButton from "~/components/NudeButton"; import NudeButton from "~/components/NudeButton";
type Props = React.ComponentProps<typeof Button> & { type Props = React.ComponentProps<typeof Button> & {
@@ -30,11 +31,11 @@ const Button = styled(NudeButton)<{ $root?: boolean }>`
position: absolute; position: absolute;
left: -24px; left: -24px;
flex-shrink: 0; flex-shrink: 0;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
&:hover { &:hover {
color: ${(props) => props.theme.text}; color: ${s("text")};
background: ${(props) => props.theme.sidebarControlHoverBackground}; background: ${s("sidebarControlHoverBackground")};
} }
${(props) => ${(props) =>

View File

@@ -1,5 +1,6 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import useToasts from "~/hooks/useToasts"; import useToasts from "~/hooks/useToasts";
type Props = { type Props = {
@@ -113,8 +114,8 @@ function EditableTitle({
} }
const Input = styled.input` const Input = styled.input`
color: ${(props) => props.theme.text}; color: ${s("text")};
background: ${(props) => props.theme.background}; background: ${s("background")};
width: calc(100% + 12px); width: calc(100% + 12px);
border-radius: 3px; border-radius: 3px;
border: 0; border: 0;
@@ -123,7 +124,7 @@ const Input = styled.input`
height: 32px; height: 32px;
&:focus { &:focus {
outline-color: ${(props) => props.theme.accent}; outline-color: ${s("accent")};
} }
`; `;

View File

@@ -1,6 +1,7 @@
import { CollapsedIcon } from "outline-icons"; import { CollapsedIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import styled, { keyframes } from "styled-components"; import styled, { keyframes } from "styled-components";
import { s } from "@shared/styles";
import usePersistedState from "~/hooks/usePersistedState"; import usePersistedState from "~/hooks/usePersistedState";
import { undraggableOnDesktop } from "~/styles"; import { undraggableOnDesktop } from "~/styles";
@@ -67,7 +68,7 @@ const Button = styled.button`
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 600;
user-select: none; user-select: none;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
letter-spacing: 0.03em; letter-spacing: 0.03em;
margin: 0; margin: 0;
padding: 4px 2px 4px 12px; padding: 4px 2px 4px 12px;
@@ -81,7 +82,7 @@ const Button = styled.button`
&:not(:disabled):hover, &:not(:disabled):hover,
&:not(:disabled):active { &:not(:disabled):active {
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
cursor: var(--pointer); cursor: var(--pointer);
} }
`; `;

View File

@@ -1,6 +1,7 @@
import { ExpandedIcon, MoreIcon } from "outline-icons"; import { ExpandedIcon, MoreIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import { undraggableOnDesktop } from "~/styles"; import { undraggableOnDesktop } from "~/styles";
@@ -46,7 +47,7 @@ const HeaderButton = React.forwardRef<HTMLButtonElement, HeaderButtonProps>(
); );
const Title = styled(Flex)` const Title = styled(Flex)`
color: ${(props) => props.theme.text}; color: ${s("text")};
flex-shrink: 1; flex-shrink: 1;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@@ -59,7 +60,7 @@ const Wrapper = styled(Flex)<{ minHeight: number }>`
font-weight: 500; font-weight: 500;
border-radius: 4px; border-radius: 4px;
margin: 8px; margin: 8px;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
border: 0; border: 0;
background: none; background: none;
flex-shrink: 0; flex-shrink: 0;
@@ -76,9 +77,9 @@ const Wrapper = styled(Flex)<{ minHeight: number }>`
&:active, &:active,
&:hover, &:hover,
&[aria-expanded="true"] { &[aria-expanded="true"] {
color: ${(props) => props.theme.sidebarText}; color: ${s("sidebarText")};
transition: background 100ms ease-in-out; transition: background 100ms ease-in-out;
background: ${(props) => props.theme.sidebarActiveBackground}; background: ${s("sidebarActiveBackground")};
} }
`; `;

View File

@@ -2,6 +2,7 @@ import { ArrowIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import NudeButton from "~/components/NudeButton"; import NudeButton from "~/components/NudeButton";
import Tooltip from "~/components/Tooltip"; import Tooltip from "~/components/Tooltip";
@@ -63,7 +64,7 @@ const Navigation = styled(Flex)`
`; `;
const Forward = styled(ArrowIcon)<{ $active: boolean }>` const Forward = styled(ArrowIcon)<{ $active: boolean }>`
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
opacity: ${(props) => (props.$active ? 1 : 0.5)}; opacity: ${(props) => (props.$active ? 1 : 0.5)};
transition: color 100ms ease-in-out; transition: color 100ms ease-in-out;

View File

@@ -1,4 +1,5 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { undraggableOnDesktop } from "~/styles"; import { undraggableOnDesktop } from "~/styles";
const ResizeBorder = styled.div<{ dir?: "left" | "right" }>` const ResizeBorder = styled.div<{ dir?: "left" | "right" }>`
@@ -14,7 +15,7 @@ const ResizeBorder = styled.div<{ dir?: "left" | "right" }>`
&:hover { &:hover {
transition-delay: 500ms; transition-delay: 500ms;
transition: background 250ms ease-in-out; transition: background 250ms ease-in-out;
background: ${(props) => props.theme.sidebarActiveBackground}; background: ${s("sidebarActiveBackground")};
} }
&:after { &:after {

View File

@@ -2,6 +2,7 @@ import { LocationDescriptor } from "history";
import * as React from "react"; import * as React from "react";
import styled, { useTheme, css } from "styled-components"; import styled, { useTheme, css } from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import { NavigationNode } from "@shared/types"; import { NavigationNode } from "@shared/types";
import EventBoundary from "~/components/EventBoundary"; import EventBoundary from "~/components/EventBoundary";
import NudeButton from "~/components/NudeButton"; import NudeButton from "~/components/NudeButton";
@@ -144,12 +145,12 @@ const Actions = styled(EventBoundary)<{ showActions?: boolean }>`
top: 4px; top: 4px;
right: 4px; right: 4px;
gap: 4px; gap: 4px;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
transition: opacity 50ms; transition: opacity 50ms;
height: 24px; height: 24px;
svg { svg {
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
fill: currentColor; fill: currentColor;
opacity: 0.5; opacity: 0.5;
} }
@@ -217,20 +218,20 @@ const Link = styled(NavLink)<{
} }
& + ${Actions} { & + ${Actions} {
background: ${(props) => props.theme.sidebarBackground}; background: ${s("sidebarBackground")};
${NudeButton} { ${NudeButton} {
background: transparent; background: transparent;
&:hover, &:hover,
&[aria-expanded="true"] { &[aria-expanded="true"] {
background: ${(props) => props.theme.sidebarControlHoverBackground}; background: ${s("sidebarControlHoverBackground")};
} }
} }
} }
&[aria-current="page"] + ${Actions} { &[aria-current="page"] + ${Actions} {
background: ${(props) => props.theme.sidebarActiveBackground}; background: ${s("sidebarActiveBackground")};
} }
${breakpoint("tablet")` ${breakpoint("tablet")`

View File

@@ -2,6 +2,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import Arrow from "~/components/Arrow"; import Arrow from "~/components/Arrow";
type Props = { type Props = {
@@ -39,10 +40,10 @@ export const ToggleButton = styled.button<{ $direction?: "left" | "right" }>`
padding: 8px; padding: 8px;
border: 0; border: 0;
pointer-events: none; pointer-events: none;
color: ${(props) => props.theme.divider}; color: ${s("divider")};
&:active { &:active {
color: ${(props) => props.theme.sidebarText}; color: ${s("sidebarText")};
} }
${breakpoint("tablet")` ${breakpoint("tablet")`

View File

@@ -1,6 +1,6 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import { id } from "~/components/SkipNavContent"; import { id } from "~/components/SkipNavContent";
export default function SkipNavLink() { export default function SkipNavLink() {
@@ -23,9 +23,9 @@ const Anchor = styled.a`
position: fixed; position: fixed;
top: 12px; top: 12px;
left: 12px; left: 12px;
background: ${(props) => props.theme.background}; background: ${s("background")};
color: ${(props) => props.theme.text}; color: ${s("text")};
outline-color: ${(props) => props.theme.accent}; outline-color: ${s("accent")};
z-index: ${depths.popover}; z-index: ${depths.popover};
width: auto; width: auto;
height: auto; height: auto;

View File

@@ -1,12 +1,13 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
type Props = { type Props = {
sticky?: boolean; sticky?: boolean;
}; };
const H3 = styled.h3` const H3 = styled.h3`
border-bottom: 1px solid ${(props) => props.theme.divider}; border-bottom: 1px solid ${s("divider")};
margin: 12px 0; margin: 12px 0;
line-height: 1; line-height: 1;
`; `;
@@ -16,7 +17,7 @@ const Underline = styled.div`
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
padding-top: 6px; padding-top: 6px;
padding-bottom: 6px; padding-bottom: 6px;
`; `;
@@ -28,8 +29,8 @@ const Background = styled.div<{ sticky?: boolean }>`
${(props) => (props.sticky ? "top: 54px;" : "")} ${(props) => (props.sticky ? "top: 54px;" : "")}
margin: 0 -8px; margin: 0 -8px;
padding: 0 8px; padding: 0 8px;
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
z-index: 1; z-index: 1;
`; `;

View File

@@ -1,5 +1,6 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { LabelText } from "~/components/Input"; import { LabelText } from "~/components/Input";
import Text from "~/components/Text"; import Text from "~/components/Text";
import { undraggableOnDesktop } from "~/styles"; import { undraggableOnDesktop } from "~/styles";
@@ -124,11 +125,11 @@ const HiddenInput = styled.input<{ width: number; height: number }>`
} }
&:checked + ${Slider} { &:checked + ${Slider} {
background-color: ${(props) => props.theme.accent}; background-color: ${s("accent")};
} }
&:focus + ${Slider} { &:focus + ${Slider} {
box-shadow: 0 0 1px ${(props) => props.theme.accent}; box-shadow: 0 0 1px ${s("accent")};
} }
&:checked + ${Slider}:before { &:checked + ${Slider}:before {

View File

@@ -1,6 +1,7 @@
import { m } from "framer-motion"; import { m } from "framer-motion";
import * as React from "react"; import * as React from "react";
import styled, { useTheme } from "styled-components"; import styled, { useTheme } from "styled-components";
import { s } from "@shared/styles";
import NavLink from "~/components/NavLink"; import NavLink from "~/components/NavLink";
type Props = Omit<React.ComponentProps<typeof NavLink>, "children"> & { type Props = Omit<React.ComponentProps<typeof NavLink>, "children"> & {
@@ -15,12 +16,12 @@ const TabLink = styled(NavLink)`
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
cursor: var(--pointer); cursor: var(--pointer);
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
margin-right: 24px; margin-right: 24px;
padding: 6px 0; padding: 6px 0;
&:hover { &:hover {
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
} }
`; `;
@@ -32,7 +33,7 @@ const Active = styled(m.div)`
height: 3px; height: 3px;
width: 100%; width: 100%;
border-radius: 3px; border-radius: 3px;
background: ${(props) => props.theme.textSecondary}; background: ${s("textSecondary")};
`; `;
const transition = { const transition = {

View File

@@ -5,6 +5,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useTable, useSortBy, usePagination } from "react-table"; import { useTable, useSortBy, usePagination } from "react-table";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Button from "~/components/Button"; import Button from "~/components/Button";
import DelayedMount from "~/components/DelayedMount"; import DelayedMount from "~/components/DelayedMount";
import Empty from "~/components/Empty"; import Empty from "~/components/Empty";
@@ -225,7 +226,7 @@ const DescSortIcon = styled(CollapsedIcon)`
margin-left: -2px; margin-left: -2px;
&:hover { &:hover {
fill: ${(props) => props.theme.text}; fill: ${s("text")};
} }
`; `;
@@ -256,7 +257,7 @@ const SortWrapper = styled(Flex)<{ $sortable: boolean }>`
const Cell = styled.td` const Cell = styled.td`
padding: 10px 6px; padding: 10px 6px;
border-bottom: 1px solid ${(props) => props.theme.divider}; border-bottom: 1px solid ${s("divider")};
font-size: 14px; font-size: 14px;
&:first-child { &:first-child {
@@ -273,7 +274,7 @@ const Cell = styled.td`
${NudeButton} { ${NudeButton} {
&:hover, &:hover,
&[aria-expanded="true"] { &[aria-expanded="true"] {
background: ${(props) => props.theme.sidebarControlHoverBackground}; background: ${s("sidebarControlHoverBackground")};
} }
} }
`; `;
@@ -299,11 +300,11 @@ const Head = styled.th`
position: sticky; position: sticky;
top: 54px; top: 54px;
padding: 6px 6px 0; padding: 6px 6px 0;
border-bottom: 1px solid ${(props) => props.theme.divider}; border-bottom: 1px solid ${s("divider")};
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
font-size: 14px; font-size: 14px;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
font-weight: 500; font-weight: 500;
z-index: 1; z-index: 1;

View File

@@ -2,10 +2,11 @@ import { AnimateSharedLayout } from "framer-motion";
import { transparentize } from "polished"; import { transparentize } from "polished";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import useWindowSize from "~/hooks/useWindowSize"; import useWindowSize from "~/hooks/useWindowSize";
const Nav = styled.nav<{ $shadowVisible?: boolean }>` const Nav = styled.nav<{ $shadowVisible?: boolean }>`
border-bottom: 1px solid ${(props) => props.theme.divider}; border-bottom: 1px solid ${s("divider")};
margin: 12px 0; margin: 12px 0;
overflow-y: auto; overflow-y: auto;
white-space: nowrap; white-space: nowrap;
@@ -43,13 +44,13 @@ const Sticky = styled.div`
top: 54px; top: 54px;
margin: 0 -8px; margin: 0 -8px;
padding: 0 8px; padding: 0 8px;
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
z-index: 1; z-index: 1;
`; `;
export const Separator = styled.span` export const Separator = styled.span`
border-left: 1px solid ${(props) => props.theme.divider}; border-left: 1px solid ${s("divider")};
position: relative; position: relative;
top: 2px; top: 2px;
margin-right: 24px; margin-right: 24px;

View File

@@ -1,9 +1,10 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Avatar from "./Avatar"; import Avatar from "./Avatar";
const TeamLogo = styled(Avatar)` const TeamLogo = styled(Avatar)`
border-radius: 4px; border-radius: 4px;
border: 1px solid ${(props) => props.theme.divider}; border: 1px solid ${s("divider")};
`; `;
export default TeamLogo; export default TeamLogo;

View File

@@ -2,6 +2,7 @@ import { CheckboxIcon, InfoIcon, WarningIcon } from "outline-icons";
import { darken } from "polished"; import { darken } from "polished";
import * as React from "react"; import * as React from "react";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import { fadeAndScaleIn, pulse } from "~/styles/animations"; import { fadeAndScaleIn, pulse } from "~/styles/animations";
import { Toast as TToast } from "~/types"; import { Toast as TToast } from "~/types";
import Spinner from "./Spinner"; import Spinner from "./Spinner";
@@ -72,7 +73,7 @@ function Toast({ closeAfterMs = 3000, onRequestClose, toast }: Props) {
const Action = styled.span` const Action = styled.span`
display: inline-block; display: inline-block;
padding: 4px 8px; padding: 4px 8px;
color: ${(props) => props.theme.toastText}; color: ${s("toastText")};
background: ${(props) => darken(0.05, props.theme.toastBackground)}; background: ${(props) => darken(0.05, props.theme.toastBackground)};
border-radius: 4px; border-radius: 4px;
margin-left: 8px; margin-left: 8px;
@@ -99,8 +100,8 @@ const Container = styled.div`
animation: ${fadeAndScaleIn} 100ms ease; animation: ${fadeAndScaleIn} 100ms ease;
margin: 8px 0; margin: 8px 0;
padding: 0 12px; padding: 0 12px;
color: ${(props) => props.theme.toastText}; color: ${s("toastText")};
background: ${(props) => props.theme.toastBackground}; background: ${s("toastBackground")};
font-size: 15px; font-size: 15px;
border-radius: 5px; border-radius: 5px;
cursor: default; cursor: default;

View File

@@ -23,8 +23,8 @@ function Toasts() {
const List = styled.ol` const List = styled.ol`
position: fixed; position: fixed;
left: ${(props) => props.theme.hpadding}; left: 16px;
bottom: ${(props) => props.theme.vpadding}; bottom: 16px;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@@ -2,6 +2,7 @@ import Tippy, { TippyProps } from "@tippyjs/react";
import * as React from "react"; import * as React from "react";
import styled, { createGlobalStyle } from "styled-components"; import styled, { createGlobalStyle } from "styled-components";
import { roundArrow } from "tippy.js"; import { roundArrow } from "tippy.js";
import { s } from "@shared/styles";
export type Props = Omit<TippyProps, "content" | "theme"> & { export type Props = Omit<TippyProps, "content" | "theme"> & {
tooltip?: React.ReactChild | React.ReactChild[]; tooltip?: React.ReactChild | React.ReactChild[];
@@ -45,9 +46,9 @@ const Shortcut = styled.kbd`
font: 10px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, font: 10px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
monospace; monospace;
line-height: 10px; line-height: 10px;
color: ${(props) => props.theme.tooltipBackground}; color: ${s("tooltipBackground")};
vertical-align: middle; vertical-align: middle;
background-color: ${(props) => props.theme.tooltipText}; background-color: ${s("tooltipText")};
border-radius: 3px; border-radius: 3px;
`; `;
@@ -60,8 +61,8 @@ export const TooltipStyles = createGlobalStyle`
} }
.tippy-box{ .tippy-box{
position:relative; position:relative;
background-color: ${(props) => props.theme.tooltipBackground}; background-color: ${s("tooltipBackground")};
color: ${(props) => props.theme.tooltipText}; color: ${s("tooltipText")};
border-radius:4px; border-radius:4px;
font-size:13px; font-size:13px;
line-height:1.4; line-height:1.4;
@@ -113,7 +114,7 @@ export const TooltipStyles = createGlobalStyle`
.tippy-arrow{ .tippy-arrow{
width:16px; width:16px;
height:16px; height:16px;
color: ${(props) => props.theme.tooltipBackground}; color: ${s("tooltipBackground")};
} }
.tippy-arrow:before{ .tippy-arrow:before{
content:""; content:"";
@@ -160,7 +161,7 @@ export const TooltipStyles = createGlobalStyle`
.tippy-svg-arrow{ .tippy-svg-arrow{
width:16px; width:16px;
height:16px; height:16px;
fill: ${(props) => props.theme.tooltipBackground}; fill: ${s("tooltipBackground")};
text-align:initial text-align:initial
} }
.tippy-svg-arrow,.tippy-svg-arrow>svg{ .tippy-svg-arrow,.tippy-svg-arrow>svg{

View File

@@ -1,5 +1,6 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
type Props = { type Props = {
/** The size to render the indicator, defaults to 24px */ /** The size to render the indicator, defaults to 24px */
@@ -20,7 +21,7 @@ export default function Typing({ size = 24 }: Props) {
} }
const Wrapper = styled.svg` const Wrapper = styled.svg`
fill: ${(props) => props.theme.textTertiary}; fill: ${s("textTertiary")};
@keyframes blink { @keyframes blink {
50% { 50% {

View File

@@ -2,7 +2,7 @@ import { NodeSelection } from "prosemirror-state";
import { CellSelection } from "prosemirror-tables"; import { CellSelection } from "prosemirror-tables";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import { Portal } from "~/components/Portal"; import { Portal } from "~/components/Portal";
import useComponentSize from "~/hooks/useComponentSize"; import useComponentSize from "~/hooks/useComponentSize";
import useEventListener from "~/hooks/useEventListener"; import useEventListener from "~/hooks/useEventListener";
@@ -217,7 +217,7 @@ const Wrapper = styled.div<{
position: absolute; position: absolute;
z-index: ${depths.editorToolbar}; z-index: ${depths.editorToolbar};
opacity: 0; opacity: 0;
background-color: ${(props) => props.theme.toolbarBackground}; background-color: ${s("toolbarBackground")};
border-radius: 4px; border-radius: 4px;
transform: scale(0.95); transform: scale(0.95);
transition: opacity 150ms cubic-bezier(0.175, 0.885, 0.32, 1.275), transition: opacity 150ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
@@ -235,7 +235,7 @@ const Wrapper = styled.div<{
width: 24px; width: 24px;
height: 24px; height: 24px;
transform: translateX(-50%) rotate(45deg); transform: translateX(-50%) rotate(45deg);
background: ${(props) => props.theme.toolbarBackground}; background: ${s("toolbarBackground")};
border-radius: 3px; border-radius: 3px;
z-index: -1; z-index: -1;
position: absolute; position: absolute;

View File

@@ -1,9 +1,10 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
const Input = styled.input` const Input = styled.input`
font-size: 15px; font-size: 15px;
background: ${(props) => props.theme.toolbarInput}; background: ${s("toolbarInput")};
color: ${(props) => props.theme.toolbarItem}; color: ${s("toolbarItem")};
border-radius: 2px; border-radius: 2px;
padding: 3px 8px; padding: 3px 8px;
border: 0; border: 0;

View File

@@ -10,6 +10,7 @@ import { setTextSelection } from "prosemirror-utils";
import { EditorView } from "prosemirror-view"; import { EditorView } from "prosemirror-view";
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { isInternalUrl, sanitizeUrl } from "@shared/utils/urls"; import { isInternalUrl, sanitizeUrl } from "@shared/utils/urls";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import { ResizingHeightContainer } from "~/components/ResizingHeightContainer"; import { ResizingHeightContainer } from "~/components/ResizingHeightContainer";
@@ -403,7 +404,7 @@ const Wrapper = styled(Flex)`
`; `;
const SearchResults = styled(Scrollable)<{ $hasResults: boolean }>` const SearchResults = styled(Scrollable)<{ $hasResults: boolean }>`
background: ${(props) => props.theme.toolbarBackground}; background: ${s("toolbarBackground")};
position: absolute; position: absolute;
top: 100%; top: 100%;
width: 100%; width: 100%;

View File

@@ -1,7 +1,7 @@
import * as React from "react"; import * as React from "react";
import scrollIntoView from "smooth-scroll-into-view-if-needed"; import scrollIntoView from "smooth-scroll-into-view-if-needed";
import styled from "styled-components"; import styled from "styled-components";
import { ellipsis } from "~/styles"; import { s, ellipsis } from "@shared/styles";
type Props = React.HTMLAttributes<HTMLDivElement> & { type Props = React.HTMLAttributes<HTMLDivElement> & {
icon: React.ReactNode; icon: React.ReactNode;
@@ -78,7 +78,7 @@ const ListItem = styled.div<{
props.selected ? props.theme.accentText : props.theme.toolbarItem}; props.selected ? props.theme.accentText : props.theme.toolbarItem};
background: ${(props) => background: ${(props) =>
props.selected ? props.theme.accent : "transparent"}; props.selected ? props.theme.accent : "transparent"};
font-family: ${(props) => props.theme.fontFamily}; font-family: ${s("fontFamily")};
text-decoration: none; text-decoration: none;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;

View File

@@ -9,7 +9,7 @@ import insertFiles from "@shared/editor/commands/insertFiles";
import { EmbedDescriptor } from "@shared/editor/embeds"; import { EmbedDescriptor } from "@shared/editor/embeds";
import filterExcessSeparators from "@shared/editor/lib/filterExcessSeparators"; import filterExcessSeparators from "@shared/editor/lib/filterExcessSeparators";
import { MenuItem } from "@shared/editor/types"; import { MenuItem } from "@shared/editor/types";
import { depths } from "@shared/styles"; import { depths, s } from "@shared/styles";
import { getEventFiles } from "@shared/utils/files"; import { getEventFiles } from "@shared/utils/files";
import { AttachmentValidation } from "@shared/validations"; import { AttachmentValidation } from "@shared/validations";
import { Portal } from "~/components/Portal"; import { Portal } from "~/components/Portal";
@@ -583,7 +583,7 @@ const LinkInputWrapper = styled.div`
const LinkInput = styled(Input)` const LinkInput = styled(Input)`
height: 32px; height: 32px;
width: 100%; width: 100%;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
`; `;
const List = styled.ol` const List = styled.ol`
@@ -602,7 +602,7 @@ const ListItem = styled.li`
const Empty = styled.div` const Empty = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
height: 32px; height: 32px;
@@ -616,14 +616,14 @@ export const Wrapper = styled(Scrollable)<{
left?: number; left?: number;
isAbove: boolean; isAbove: boolean;
}>` }>`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
font-family: ${(props) => props.theme.fontFamily}; font-family: ${s("fontFamily")};
position: absolute; position: absolute;
z-index: ${depths.editorToolbar}; z-index: ${depths.editorToolbar};
${(props) => props.top !== undefined && `top: ${props.top}px`}; ${(props) => props.top !== undefined && `top: ${props.top}px`};
${(props) => props.bottom !== undefined && `bottom: ${props.bottom}px`}; ${(props) => props.bottom !== undefined && `bottom: ${props.bottom}px`};
left: ${(props) => props.left}px; left: ${(props) => props.left}px;
background: ${(props) => props.theme.menuBackground}; background: ${s("menuBackground")};
border-radius: 6px; border-radius: 6px;
box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px, box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px,
rgba(0, 0, 0, 0.08) 0px 4px 8px, rgba(0, 0, 0, 0.08) 0px 2px 4px; rgba(0, 0, 0, 0.08) 0px 4px 8px, rgba(0, 0, 0, 0.08) 0px 2px 4px;
@@ -647,7 +647,7 @@ export const Wrapper = styled(Scrollable)<{
hr { hr {
border: 0; border: 0;
height: 0; height: 0;
border-top: 1px solid ${(props) => props.theme.divider}; border-top: 1px solid ${s("divider")};
} }
${({ active, isAbove }) => ${({ active, isAbove }) =>

View File

@@ -1,4 +1,5 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
type Props = { active?: boolean; disabled?: boolean }; type Props = { active?: boolean; disabled?: boolean };
@@ -18,7 +19,7 @@ export default styled.button.attrs((props) => ({
outline: none; outline: none;
pointer-events: all; pointer-events: all;
position: relative; position: relative;
color: ${(props) => props.theme.toolbarItem}; color: ${s("toolbarItem")};
&:hover { &:hover {
opacity: 1; opacity: 1;

View File

@@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import styled from "styled-components"; import styled from "styled-components";
import { MenuItem } from "@shared/editor/types"; import { MenuItem } from "@shared/editor/types";
import { s } from "@shared/styles";
import { useEditor } from "./EditorContext"; import { useEditor } from "./EditorContext";
import ToolbarButton from "./ToolbarButton"; import ToolbarButton from "./ToolbarButton";
import ToolbarSeparator from "./ToolbarSeparator"; import ToolbarSeparator from "./ToolbarSeparator";
@@ -11,7 +12,7 @@ type Props = {
}; };
const FlexibleWrapper = styled.div` const FlexibleWrapper = styled.div`
color: ${(props) => props.theme.toolbarItem}; color: ${s("toolbarItem")};
display: flex; display: flex;
gap: 8px; gap: 8px;
`; `;

View File

@@ -1,9 +1,10 @@
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
const Separator = styled.div` const Separator = styled.div`
height: 24px; height: 24px;
width: 2px; width: 2px;
background: ${(props) => props.theme.toolbarItem}; background: ${s("toolbarItem")};
opacity: 0.3; opacity: 0.3;
display: inline-block; display: inline-block;
margin-left: 8px; margin-left: 8px;

View File

@@ -7,6 +7,7 @@ import { useMenuState, MenuButton, MenuButtonHTMLProps } from "reakit/Menu";
import { VisuallyHidden } from "reakit/VisuallyHidden"; import { VisuallyHidden } from "reakit/VisuallyHidden";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s, ellipsis } from "@shared/styles";
import { getEventFiles } from "@shared/utils/files"; import { getEventFiles } from "@shared/utils/files";
import Document from "~/models/Document"; import Document from "~/models/Document";
import ContextMenu from "~/components/ContextMenu"; import ContextMenu from "~/components/ContextMenu";
@@ -45,7 +46,6 @@ import usePolicy from "~/hooks/usePolicy";
import useRequest from "~/hooks/useRequest"; import useRequest from "~/hooks/useRequest";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts"; import useToasts from "~/hooks/useToasts";
import { ellipsis } from "~/styles";
import { MenuItem } from "~/types"; import { MenuItem } from "~/types";
import { editDocumentUrl, newDocumentPath } from "~/utils/routeHelpers"; import { editDocumentUrl, newDocumentPath } from "~/utils/routeHelpers";
@@ -338,7 +338,7 @@ function DocumentMenu({
const ToggleMenuItem = styled(Switch)` const ToggleMenuItem = styled(Switch)`
* { * {
font-weight: normal; font-weight: normal;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
} }
`; `;

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { MenuButton, useMenuState } from "reakit/Menu"; import { MenuButton, useMenuState } from "reakit/Menu";
import styled from "styled-components"; import styled from "styled-components";
import { ellipsis } from "@shared/styles";
import Button from "~/components/Button"; import Button from "~/components/Button";
import ContextMenu from "~/components/ContextMenu"; import ContextMenu from "~/components/ContextMenu";
import Header from "~/components/ContextMenu/Header"; import Header from "~/components/ContextMenu/Header";
@@ -12,7 +13,6 @@ import CollectionIcon from "~/components/Icons/CollectionIcon";
import useCurrentTeam from "~/hooks/useCurrentTeam"; import useCurrentTeam from "~/hooks/useCurrentTeam";
import usePolicy from "~/hooks/usePolicy"; import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import { ellipsis } from "~/styles";
import { MenuItem } from "~/types"; import { MenuItem } from "~/types";
import { newDocumentPath } from "~/utils/routeHelpers"; import { newDocumentPath } from "~/utils/routeHelpers";

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { MenuButton, useMenuState } from "reakit/Menu"; import { MenuButton, useMenuState } from "reakit/Menu";
import styled from "styled-components"; import styled from "styled-components";
import { ellipsis } from "@shared/styles";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Button from "~/components/Button"; import Button from "~/components/Button";
import ContextMenu from "~/components/ContextMenu"; import ContextMenu from "~/components/ContextMenu";
@@ -11,7 +12,6 @@ import MenuItem from "~/components/ContextMenu/MenuItem";
import Separator from "~/components/ContextMenu/Separator"; import Separator from "~/components/ContextMenu/Separator";
import useCurrentUser from "~/hooks/useCurrentUser"; import useCurrentUser from "~/hooks/useCurrentUser";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import { ellipsis } from "~/styles";
import { replaceTitleVariables } from "~/utils/date"; import { replaceTitleVariables } from "~/utils/date";
type Props = { type Props = {

View File

@@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { CollectionPermission } from "@shared/types"; import { CollectionPermission } from "@shared/types";
import CollectionGroupMembership from "~/models/CollectionGroupMembership"; import CollectionGroupMembership from "~/models/CollectionGroupMembership";
import Group from "~/models/Group"; import Group from "~/models/Group";
@@ -66,7 +67,7 @@ const Select = styled(InputSelect)`
font-size: 14px; font-size: 14px;
border-color: transparent; border-color: transparent;
box-shadow: none; box-shadow: none;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
select { select {
margin: 0; margin: 0;

View File

@@ -2,6 +2,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { CollectionPermission } from "@shared/types"; import { CollectionPermission } from "@shared/types";
import Membership from "~/models/Membership"; import Membership from "~/models/Membership";
import User from "~/models/User"; import User from "~/models/User";
@@ -94,7 +95,7 @@ const Select = styled(InputSelect)`
font-size: 14px; font-size: 14px;
border-color: transparent; border-color: transparent;
box-shadow: none; box-shadow: none;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
select { select {
margin: 0; margin: 0;

View File

@@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import Heading from "~/components/Heading"; import Heading from "~/components/Heading";
import PageTitle from "~/components/PageTitle"; import PageTitle from "~/components/PageTitle";
@@ -40,7 +41,7 @@ const DesktopRedirect = () => {
}; };
const Note = styled(Text)` const Note = styled(Text)`
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
margin-top: 8px; margin-top: 8px;

View File

@@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
import { RouteComponentProps, useLocation, Redirect } from "react-router-dom"; import { RouteComponentProps, useLocation, Redirect } from "react-router-dom";
import styled, { ThemeProvider } from "styled-components"; import styled, { ThemeProvider } from "styled-components";
import { setCookie } from "tiny-cookie"; import { setCookie } from "tiny-cookie";
import { s } from "@shared/styles";
import { CustomTheme, NavigationNode } from "@shared/types"; import { CustomTheme, NavigationNode } from "@shared/types";
import DocumentModel from "~/models/Document"; import DocumentModel from "~/models/Document";
import Error404 from "~/scenes/Error404"; import Error404 from "~/scenes/Error404";
@@ -197,7 +198,7 @@ function SharedDocumentScene(props: Props) {
} }
const Content = styled(Text)` const Content = styled(Text)`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
text-align: center; text-align: center;
margin-top: -8px; margin-top: -8px;
`; `;

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import scrollIntoView from "smooth-scroll-into-view-if-needed"; import scrollIntoView from "smooth-scroll-into-view-if-needed";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import Comment from "~/models/Comment"; import Comment from "~/models/Comment";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
@@ -199,7 +200,7 @@ const Reply = styled.button`
padding: 8px; padding: 8px;
margin: 0; margin: 0;
background: none; background: none;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
font-size: 14px; font-size: 14px;
-webkit-appearance: none; -webkit-appearance: none;
cursor: var(--pointer); cursor: var(--pointer);

View File

@@ -4,6 +4,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import { Minute } from "@shared/utils/time"; import { Minute } from "@shared/utils/time";
import Comment from "~/models/Comment"; import Comment from "~/models/Comment";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
@@ -223,7 +224,7 @@ const Menu = styled(CommentMenu)<{ dir?: "rtl" | "ltr" }>`
&:hover, &:hover,
&[aria-expanded="true"] { &[aria-expanded="true"] {
opacity: 1; opacity: 1;
background: ${(props) => props.theme.sidebarActiveBackground}; background: ${s("sidebarActiveBackground")};
} }
`; `;
@@ -246,13 +247,12 @@ export const Bubble = styled(Flex)<{
position: relative; position: relative;
flex-grow: 1; flex-grow: 1;
font-size: 15px; font-size: 15px;
color: ${(props) => props.theme.text}; color: ${s("text")};
background: ${(props) => props.theme.commentBackground}; background: ${s("commentBackground")};
min-width: 2em; min-width: 2em;
margin-bottom: 1px; margin-bottom: 1px;
padding: 8px 12px; padding: 8px 12px;
transition: color 100ms ease-out, transition: color 100ms ease-out, ${s("backgroundTransition")};
${(props) => props.theme.backgroundTransition};
${({ $lastOfThread }) => ${({ $lastOfThread }) =>
$lastOfThread && $lastOfThread &&

View File

@@ -3,6 +3,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import Text from "~/components/Text"; import Text from "~/components/Text";
import useWindowScrollPosition from "~/hooks/useWindowScrollPosition"; import useWindowScrollPosition from "~/hooks/useWindowScrollPosition";
@@ -101,8 +102,8 @@ const Sticky = styled.div`
top: 80px; top: 80px;
max-height: calc(100vh - 80px); max-height: calc(100vh - 80px);
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
margin-top: 72px; margin-top: 72px;
margin-right: 52px; margin-right: 52px;
@@ -122,7 +123,7 @@ const Sticky = styled.div`
const Heading = styled.h3` const Heading = styled.h3`
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 600;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
letter-spacing: 0.03em; letter-spacing: 0.03em;
`; `;
@@ -145,11 +146,11 @@ const ListItem = styled.li<{ level: number; active?: boolean }>`
`; `;
const Link = styled.a` const Link = styled.a`
color: ${(props) => props.theme.text}; color: ${s("text")};
font-size: 14px; font-size: 14px;
&:hover { &:hover {
color: ${(props) => props.theme.accent}; color: ${s("accent")};
} }
`; `;

View File

@@ -13,6 +13,7 @@ import {
} from "react-router"; } from "react-router";
import styled from "styled-components"; import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import { NavigationNode } from "@shared/types"; import { NavigationNode } from "@shared/types";
import { Heading } from "@shared/utils/ProsemirrorHelper"; import { Heading } from "@shared/utils/ProsemirrorHelper";
import { parseDomain } from "@shared/utils/domains"; import { parseDomain } from "@shared/utils/domains";
@@ -36,6 +37,7 @@ import { client } from "~/utils/ApiClient";
import { replaceTitleVariables } from "~/utils/date"; import { replaceTitleVariables } from "~/utils/date";
import { emojiToUrl } from "~/utils/emoji"; import { emojiToUrl } from "~/utils/emoji";
import { isModKey } from "~/utils/keyboard"; import { isModKey } from "~/utils/keyboard";
import { import {
documentHistoryUrl, documentHistoryUrl,
editDocumentUrl, editDocumentUrl,
@@ -574,8 +576,8 @@ const Footer = styled.div`
const Background = styled(Container)` const Background = styled(Container)`
position: relative; position: relative;
background: ${(props) => props.theme.background}; background: ${s("background")};
transition: ${(props) => props.theme.backgroundTransition}; transition: ${s("backgroundTransition")};
`; `;
const ReferencesWrapper = styled.div<{ isOnlyTitle?: boolean }>` const ReferencesWrapper = styled.div<{ isOnlyTitle?: boolean }>`

View File

@@ -7,6 +7,7 @@ import styled from "styled-components";
import breakpoint from "styled-components-breakpoint"; import breakpoint from "styled-components-breakpoint";
import isMarkdown from "@shared/editor/lib/isMarkdown"; import isMarkdown from "@shared/editor/lib/isMarkdown";
import normalizePastedMarkdown from "@shared/editor/lib/markdown/normalize"; import normalizePastedMarkdown from "@shared/editor/lib/markdown/normalize";
import { s } from "@shared/styles";
import { light } from "@shared/styles/theme"; import { light } from "@shared/styles/theme";
import { import {
getCurrentDateAsString, getCurrentDateAsString,
@@ -238,8 +239,8 @@ const Title = styled(ContentEditable)<TitleProps>`
} }
&::placeholder { &::placeholder {
color: ${(props) => props.theme.placeholder}; color: ${s("placeholder")};
-webkit-text-fill-color: ${(props) => props.theme.placeholder}; -webkit-text-fill-color: ${s("placeholder")};
} }
${breakpoint("tablet")` ${breakpoint("tablet")`

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useHistory, useRouteMatch } from "react-router-dom"; import { useHistory, useRouteMatch } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import User from "~/models/User"; import User from "~/models/User";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
import { useDocumentContext } from "~/components/DocumentContext"; import { useDocumentContext } from "~/components/DocumentContext";
@@ -179,7 +180,7 @@ const List = styled("ul")`
content: "·"; content: "·";
display: inline-block; display: inline-block;
font-weight: 600; font-weight: 600;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
width: 10px; width: 10px;
} }
`; `;

View File

@@ -3,12 +3,13 @@ import { DocumentIcon } from "outline-icons";
import * as React from "react"; import * as React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s, ellipsis } from "@shared/styles";
import { NavigationNode } from "@shared/types"; import { NavigationNode } from "@shared/types";
import parseTitle from "@shared/utils/parseTitle"; import parseTitle from "@shared/utils/parseTitle";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import EmojiIcon from "~/components/Icons/EmojiIcon"; import EmojiIcon from "~/components/Icons/EmojiIcon";
import { ellipsis, hover } from "~/styles"; import { hover } from "~/styles";
import { sharedDocumentPath } from "~/utils/routeHelpers"; import { sharedDocumentPath } from "~/utils/routeHelpers";
type Props = { type Props = {
@@ -32,12 +33,12 @@ const DocumentLink = styled(Link)`
&:${hover}, &:${hover},
&:active, &:active,
&:focus { &:focus {
background: ${(props) => props.theme.listItemHoverBackground}; background: ${s("listItemHoverBackground")};
} }
`; `;
const Content = styled(Flex)` const Content = styled(Flex)`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
margin-left: -4px; margin-left: -4px;
`; `;
@@ -47,7 +48,7 @@ const Title = styled.div`
font-weight: 500; font-weight: 500;
line-height: 1.25; line-height: 1.25;
padding-top: 3px; padding-top: 3px;
color: ${(props) => props.theme.text}; color: ${s("text")};
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
`; `;

View File

@@ -7,6 +7,7 @@ import * as React from "react";
import { useTranslation, Trans } from "react-i18next"; import { useTranslation, Trans } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { SHARE_URL_SLUG_REGEX } from "@shared/utils/urlHelpers"; import { SHARE_URL_SLUG_REGEX } from "@shared/utils/urlHelpers";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Share from "~/models/Share"; import Share from "~/models/Share";
@@ -349,7 +350,7 @@ function SharePopover({
} }
const StyledLink = styled(Link)` const StyledLink = styled(Link)`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
text-decoration: underline; text-decoration: underline;
`; `;
@@ -374,14 +375,14 @@ const NoticeWrapper = styled.div`
const MoreOptionsButton = styled(Button)` const MoreOptionsButton = styled(Button)`
background: none; background: none;
font-size: 14px; font-size: 14px;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
margin-left: -8px; margin-left: -8px;
`; `;
const Separator = styled.div` const Separator = styled.div`
height: 1px; height: 1px;
width: 100%; width: 100%;
background-color: ${(props) => props.theme.divider}; background-color: ${s("divider")};
`; `;
const SwitchLabel = styled(Flex)` const SwitchLabel = styled(Flex)`

View File

@@ -4,13 +4,12 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Portal } from "react-portal"; import { Portal } from "react-portal";
import styled from "styled-components"; import styled from "styled-components";
import { depths } from "@shared/styles"; import { depths, s, ellipsis } from "@shared/styles";
import Button from "~/components/Button"; import Button from "~/components/Button";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import Scrollable from "~/components/Scrollable"; import Scrollable from "~/components/Scrollable";
import Tooltip from "~/components/Tooltip"; import Tooltip from "~/components/Tooltip";
import useMobile from "~/hooks/useMobile"; import useMobile from "~/hooks/useMobile";
import { ellipsis } from "~/styles";
import { fadeIn } from "~/styles/animations"; import { fadeIn } from "~/styles/animations";
type Props = React.HTMLAttributes<HTMLDivElement> & { type Props = React.HTMLAttributes<HTMLDivElement> & {
@@ -67,7 +66,7 @@ const Backdrop = styled.a`
right: 0; right: 0;
cursor: default; cursor: default;
z-index: ${depths.sidebar - 1}; z-index: ${depths.sidebar - 1};
background: ${(props) => props.theme.backdrop}; background: ${s("backdrop")};
`; `;
const ForwardIcon = styled(BackIcon)` const ForwardIcon = styled(BackIcon)`
@@ -91,7 +90,7 @@ const Header = styled(Flex)`
align-items: center; align-items: center;
position: relative; position: relative;
padding: 16px 12px 16px 16px; padding: 16px 12px 16px 16px;
color: ${(props) => props.theme.text}; color: ${s("text")};
flex-shrink: 0; flex-shrink: 0;
`; `;

View File

@@ -3,6 +3,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { useTranslation, Trans } from "react-i18next"; import { useTranslation, Trans } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { ellipsis } from "@shared/styles";
import { NavigationNode } from "@shared/types"; import { NavigationNode } from "@shared/types";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Button from "~/components/Button"; import Button from "~/components/Button";
@@ -12,7 +13,6 @@ import Text from "~/components/Text";
import useCollectionTrees from "~/hooks/useCollectionTrees"; import useCollectionTrees from "~/hooks/useCollectionTrees";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts"; import useToasts from "~/hooks/useToasts";
import { ellipsis } from "~/styles";
import { flattenTree } from "~/utils/tree"; import { flattenTree } from "~/utils/tree";
type Props = { type Props = {

View File

@@ -3,6 +3,7 @@ import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { useTranslation, Trans } from "react-i18next"; import { useTranslation, Trans } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { ellipsis } from "@shared/styles";
import { NavigationNode } from "@shared/types"; import { NavigationNode } from "@shared/types";
import Document from "~/models/Document"; import Document from "~/models/Document";
import Button from "~/components/Button"; import Button from "~/components/Button";
@@ -12,7 +13,6 @@ import Text from "~/components/Text";
import useCollectionTrees from "~/hooks/useCollectionTrees"; import useCollectionTrees from "~/hooks/useCollectionTrees";
import useStores from "~/hooks/useStores"; import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts"; import useToasts from "~/hooks/useToasts";
import { ellipsis } from "~/styles";
import { flattenTree } from "~/utils/tree"; import { flattenTree } from "~/utils/tree";
type Props = { type Props = {

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation, Trans } from "react-i18next"; import { useTranslation, Trans } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import { Role } from "@shared/types"; import { Role } from "@shared/types";
import { UserValidation } from "@shared/validations"; import { UserValidation } from "@shared/validations";
import Button from "~/components/Button"; import Button from "~/components/Button";
@@ -272,7 +273,7 @@ function Invite({ onSubmit }: Props) {
const CopyBlock = styled("div")` const CopyBlock = styled("div")`
margin: 2em 0; margin: 2em 0;
font-size: 14px; font-size: 14px;
background: ${(props) => props.theme.secondaryBackground}; background: ${s("secondaryBackground")};
border-radius: 8px; border-radius: 8px;
padding: 16px 16px 8px; padding: 16px 16px 8px;
`; `;

View File

@@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Flex from "~/components/Flex"; import Flex from "~/components/Flex";
import InputSearch from "~/components/InputSearch"; import InputSearch from "~/components/InputSearch";
import Key from "~/components/Key"; import Key from "~/components/Key";
@@ -450,7 +451,7 @@ const Keys = styled.dt`
clear: left; clear: left;
text-align: right; text-align: right;
font-size: 12px; font-size: 12px;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
@@ -462,7 +463,7 @@ const Label = styled.dd`
margin: 0 0 10px; margin: 0 0 10px;
display: flex; display: flex;
align-items: center; align-items: center;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
`; `;
export default React.memo(KeyboardShortcuts); export default React.memo(KeyboardShortcuts);

View File

@@ -1,4 +1,5 @@
import * as React from "react"; import * as React from "react";
import { Trans } from "react-i18next";
import NoticeAlert from "~/components/NoticeAlert"; import NoticeAlert from "~/components/NoticeAlert";
import useQuery from "~/hooks/useQuery"; import useQuery from "~/hooks/useQuery";
@@ -7,97 +8,101 @@ export default function Notices() {
const notice = query.get("notice"); const notice = query.get("notice");
const description = query.get("description"); const description = query.get("description");
if (!notice) {
return null;
}
return ( return (
<> <NoticeAlert>
{notice === "domain-required" && ( {notice === "domain-required" && (
<NoticeAlert> <Trans>
Unable to sign-in. Please navigate to your team's custom URL, then try Unable to sign-in. Please navigate to your team's custom URL, then try
to sign-in again. to sign-in again.
<hr /> <hr />
If you were invited to a team, you will find a link to it in the If you were invited to a team, you will find a link to it in the
invite email. invite email.
</NoticeAlert> </Trans>
)} )}
{notice === "gmail-account-creation" && ( {notice === "gmail-account-creation" && (
<NoticeAlert> <Trans>
Sorry, a new account cannot be created with a personal Gmail address. Sorry, a new account cannot be created with a personal Gmail address.
<hr /> <hr />
Please use a Google Workspaces account instead. Please use a Google Workspaces account instead.
</NoticeAlert> </Trans>
)} )}
{notice === "maximum-teams" && ( {notice === "maximum-teams" && (
<NoticeAlert> <Trans>
The team you authenticated with is not authorized on this The team you authenticated with is not authorized on this
installation. Try another? installation. Try another?
</NoticeAlert> </Trans>
)} )}
{notice === "malformed-user-info" && ( {notice === "malformed-user-info" && (
<NoticeAlert> <Trans>
We could not read the user info supplied by your identity provider. We could not read the user info supplied by your identity provider.
</NoticeAlert> </Trans>
)} )}
{notice === "email-auth-required" && ( {notice === "email-auth-required" && (
<NoticeAlert> <Trans>
Your account uses email sign-in, please sign-in with email to Your account uses email sign-in, please sign-in with email to
continue. continue.
</NoticeAlert> </Trans>
)} )}
{notice === "email-auth-ratelimit" && ( {notice === "email-auth-ratelimit" && (
<NoticeAlert> <Trans>
An email sign-in link was recently sent, please check your inbox or An email sign-in link was recently sent, please check your inbox or
try again in a few minutes. try again in a few minutes.
</NoticeAlert> </Trans>
)} )}
{(notice === "auth-error" || notice === "state-mismatch") && {(notice === "auth-error" || notice === "state-mismatch") &&
(description ? ( (description ? (
<NoticeAlert>{description}</NoticeAlert> <>{description}</>
) : ( ) : (
<NoticeAlert> <Trans>
Authentication failed we were unable to sign you in at this time. Authentication failed we were unable to sign you in at this time.
Please try again. Please try again.
</NoticeAlert> </Trans>
))} ))}
{notice === "invalid-authentication" && {notice === "invalid-authentication" &&
(description ? ( (description ? (
<NoticeAlert>{description}</NoticeAlert> <>{description}</>
) : ( ) : (
<NoticeAlert> <Trans>
Authentication failed you do not have permission to access this Authentication failed you do not have permission to access this
team. team.
</NoticeAlert> </Trans>
))} ))}
{notice === "expired-token" && ( {notice === "expired-token" && (
<NoticeAlert> <Trans>
Sorry, it looks like that sign-in link is no longer valid, please try Sorry, it looks like that sign-in link is no longer valid, please try
requesting another. requesting another.
</NoticeAlert> </Trans>
)} )}
{notice === "suspended" && ( {notice === "suspended" && (
<NoticeAlert> <Trans>
Your account has been suspended. To re-activate your account, please Your account has been suspended. To re-activate your account, please
contact a team admin. contact a team admin.
</NoticeAlert> </Trans>
)} )}
{notice === "authentication-provider-disabled" && ( {notice === "authentication-provider-disabled" && (
<NoticeAlert> <Trans>
Authentication failed this login method was disabled by a team Authentication failed this login method was disabled by a team
admin. admin.
</NoticeAlert> </Trans>
)} )}
{notice === "invite-required" && ( {notice === "invite-required" && (
<NoticeAlert> <Trans>
The team you are trying to join requires an invite before you can The team you are trying to join requires an invite before you can
create an account. create an account.
<hr /> <hr />
Please request an invite from your team admin and try again. Please request an invite from your team admin and try again.
</NoticeAlert> </Trans>
)} )}
{notice === "domain-not-allowed" && ( {notice === "domain-not-allowed" && (
<NoticeAlert> <Trans>
Sorry, your domain is not allowed. Please try again with an allowed Sorry, your domain is not allowed. Please try again with an allowed
team domain. team domain.
</NoticeAlert> </Trans>
)} )}
</> </NoticeAlert>
); );
} }

View File

@@ -6,6 +6,7 @@ import { Trans, useTranslation } from "react-i18next";
import { useLocation, Link, Redirect } from "react-router-dom"; import { useLocation, Link, Redirect } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { getCookie, setCookie } from "tiny-cookie"; import { getCookie, setCookie } from "tiny-cookie";
import { s } from "@shared/styles";
import { parseDomain } from "@shared/utils/domains"; import { parseDomain } from "@shared/utils/domains";
import { Config } from "~/stores/AuthStore"; import { Config } from "~/stores/AuthStore";
import ButtonLarge from "~/components/ButtonLarge"; import ButtonLarge from "~/components/ButtonLarge";
@@ -278,7 +279,7 @@ const CheckEmailIcon = styled(EmailIcon)`
const Background = styled(Fade)` const Background = styled(Fade)`
width: 100vw; width: 100vw;
height: 100%; height: 100%;
background: ${(props) => props.theme.background}; background: ${s("background")};
display: flex; display: flex;
${draggableOnDesktop()} ${draggableOnDesktop()}
`; `;
@@ -288,13 +289,13 @@ const Logo = styled.div`
`; `;
const Content = styled(Text)` const Content = styled(Text)`
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
text-align: center; text-align: center;
margin-top: -8px; margin-top: -8px;
`; `;
const Note = styled(Text)` const Note = styled(Text)`
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
margin-top: 8px; margin-top: 8px;
@@ -337,8 +338,8 @@ const Or = styled.hr`
transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0);
text-transform: uppercase; text-transform: uppercase;
font-size: 11px; font-size: 11px;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
background: ${(props) => props.theme.background}; background: ${s("background")};
border-radius: 2px; border-radius: 2px;
padding: 0 4px; padding: 0 4px;
} }

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import styled from "styled-components"; import styled from "styled-components";
import { s } from "@shared/styles";
import Fade from "~/components/Fade"; import Fade from "~/components/Fade";
import NudeButton from "~/components/NudeButton"; import NudeButton from "~/components/NudeButton";
import Tooltip from "~/components/Tooltip"; import Tooltip from "~/components/Tooltip";
@@ -53,7 +54,7 @@ const Heading = styled.h2`
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
margin-bottom: 0; margin-bottom: 0;
`; `;
@@ -70,7 +71,7 @@ const ListItem = styled.li`
&:before { &:before {
content: "·"; content: "·";
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
position: absolute; position: absolute;
left: -8px; left: -8px;
} }
@@ -78,24 +79,24 @@ const ListItem = styled.li`
const RemoveButton = styled(NudeButton)` const RemoveButton = styled(NudeButton)`
opacity: 0; opacity: 0;
color: ${(props) => props.theme.textTertiary}; color: ${s("textTertiary")};
&:hover { &:hover {
color: ${(props) => props.theme.text}; color: ${s("text")};
} }
`; `;
const RecentSearch = styled(Link)` const RecentSearch = styled(Link)`
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
color: ${(props) => props.theme.textSecondary}; color: ${s("textSecondary")};
cursor: var(--pointer); cursor: var(--pointer);
padding: 1px 4px; padding: 1px 4px;
border-radius: 4px; border-radius: 4px;
&: ${hover} { &: ${hover} {
color: ${(props) => props.theme.text}; color: ${s("text")};
background: ${(props) => props.theme.secondaryBackground}; background: ${s("secondaryBackground")};
${RemoveButton} { ${RemoveButton} {
opacity: 1; opacity: 1;

Some files were not shown because too many files have changed in this diff Show More