mirror of
https://github.com/outline/outline.git
synced 2026-11-25 15:15:15 +03:00
feat: Increase small text sizes on mobile (#14255)
This commit is contained in:
1 parent
cfa9e09f17
commit
d142bf1f44
9 files changed
+58
-28
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import styled, { css } from "styled-components";
|
||||
import { textSizeStyles } from "@shared/components/Text";
|
||||
import { breakpoint } from "@shared/styles/breakpoint";
|
||||
import { s } from "@shared/styles";
|
||||
import Flex from "~/components/Flex";
|
||||
@@ -47,7 +48,7 @@ export const metaStyles = css<{ $rtl?: boolean }>`
|
||||
*/
|
||||
export const headerMetaStyles = css`
|
||||
margin: -12px 0 2em 0;
|
||||
font-size: 14px;
|
||||
${textSizeStyles("small")}
|
||||
position: relative;
|
||||
user-select: none;
|
||||
z-index: 1;
|
||||
|
||||
@@ -39,13 +39,12 @@ const Title = styled.span`
|
||||
font-size: 16px;
|
||||
`;
|
||||
|
||||
const Container = styled(Text)`
|
||||
const Container = styled(Text).attrs({ size: "small" })`
|
||||
background: ${s("sidebarBackground")};
|
||||
color: ${s("textTertiary")};
|
||||
padding: 10px 12px;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
margin: 1em 0;
|
||||
|
||||
svg {
|
||||
|
||||
@@ -5,10 +5,9 @@ import Text from "~/components/Text";
|
||||
/**
|
||||
* Highlighted text associated with a comment.
|
||||
*/
|
||||
export const HighlightedText = styled(Text)`
|
||||
export const HighlightedText = styled(Text).attrs({ size: "small" })`
|
||||
position: relative;
|
||||
color: ${s("textSecondary")};
|
||||
font-size: 14px;
|
||||
padding: 0 8px;
|
||||
margin: 4px 0;
|
||||
display: inline-block;
|
||||
|
||||
@@ -20,6 +20,7 @@ import Editor from "~/components/Editor";
|
||||
import { useSplitView } from "~/components/SplitView/context";
|
||||
import type { Editor as SharedEditor } from "~/editor";
|
||||
import Flex from "~/components/Flex";
|
||||
import { headerMetaStyles } from "~/components/HeaderMeta";
|
||||
import PlaceholderDocument from "~/components/PlaceholderDocument";
|
||||
import Time from "~/components/Time";
|
||||
import { withUIExtensions } from "~/editor/extensions";
|
||||
@@ -304,8 +305,7 @@ function DocumentEditor(props: Props) {
|
||||
}
|
||||
|
||||
const SharedMeta = styled(Text)`
|
||||
margin: -12px 0 2em 0;
|
||||
font-size: 14px;
|
||||
${headerMetaStyles}
|
||||
`;
|
||||
|
||||
export default observer(DocumentEditor);
|
||||
@@ -479,10 +479,9 @@ const TopBar = styled.div<{ $idle: boolean }>`
|
||||
transition: opacity 300ms ease;
|
||||
`;
|
||||
|
||||
const SlideCounter = styled(Text)`
|
||||
const SlideCounter = styled(Text).attrs({ size: "small" })`
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: ${s("textTertiary")};
|
||||
font-size: 14px;
|
||||
min-width: 60px;
|
||||
text-align: center;
|
||||
`;
|
||||
|
||||
@@ -445,10 +445,9 @@ const Content = styled(Text)`
|
||||
margin-top: -8px;
|
||||
`;
|
||||
|
||||
const Note = styled(Text)`
|
||||
const Note = styled(Text).attrs({ size: "small" })`
|
||||
color: ${s("textTertiary")};
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
|
||||
em {
|
||||
|
||||
@@ -29,10 +29,9 @@ export function SigningIn() {
|
||||
);
|
||||
}
|
||||
|
||||
const Note = styled(Text)`
|
||||
const Note = styled(Text).attrs({ size: "small" })`
|
||||
color: ${s("textTertiary")};
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
|
||||
em {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Action } from "~/components/Actions";
|
||||
import Button from "~/components/Button";
|
||||
import CenteredContent from "~/components/CenteredContent";
|
||||
import Flex from "~/components/Flex";
|
||||
import { headerMetaStyles } from "~/components/HeaderMeta";
|
||||
import Heading from "~/components/Heading";
|
||||
import CollectionIcon from "~/components/Icons/CollectionIcon";
|
||||
import Scene from "~/components/Scene";
|
||||
@@ -102,8 +103,7 @@ const CollectionHeading = styled(Heading)`
|
||||
`;
|
||||
|
||||
const SharedMeta = styled(Text)`
|
||||
margin: -12px 0 2em 0;
|
||||
font-size: 14px;
|
||||
${headerMetaStyles}
|
||||
`;
|
||||
|
||||
export const Collection = observer(SharedCollection);
|
||||
+47
-13
@@ -1,11 +1,56 @@
|
||||
import styled, { css } from "styled-components";
|
||||
import { ellipsis } from "../styles";
|
||||
import { breakpoint } from "../styles/breakpoint";
|
||||
|
||||
type TextSize = "xlarge" | "large" | "medium" | "small" | "xsmall";
|
||||
|
||||
const fontSizes: Record<TextSize, number> = {
|
||||
xlarge: 26,
|
||||
large: 18,
|
||||
medium: 16,
|
||||
small: 14,
|
||||
xsmall: 13,
|
||||
};
|
||||
|
||||
const mobileSizes: Partial<Record<TextSize, TextSize>> = {
|
||||
medium: "large",
|
||||
small: "medium",
|
||||
xsmall: "small",
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the font-size styles for a text size variant. Smaller variants are
|
||||
* bumped up to the next size on mobile.
|
||||
*
|
||||
* @param size the size variant, or undefined to inherit.
|
||||
* @returns the font-size styles.
|
||||
*/
|
||||
export const textSizeStyles = (size?: TextSize) => {
|
||||
if (!size) {
|
||||
return css`
|
||||
font-size: inherit;
|
||||
`;
|
||||
}
|
||||
|
||||
const mobileSize = mobileSizes[size];
|
||||
|
||||
return css`
|
||||
font-size: ${fontSizes[size]}px;
|
||||
|
||||
${
|
||||
mobileSize &&
|
||||
breakpoint("mobile", "tablet")`
|
||||
font-size: ${fontSizes[mobileSize]}px;
|
||||
`
|
||||
}
|
||||
`;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
/** The type of text to render */
|
||||
type?: "secondary" | "tertiary" | "danger";
|
||||
/** The size of the text */
|
||||
size?: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
||||
size?: TextSize;
|
||||
/** The direction of the text (defaults to ltr) */
|
||||
dir?: "ltr" | "rtl" | "auto";
|
||||
/** Whether the text should be selectable (defaults to false) */
|
||||
@@ -35,18 +80,7 @@ const Text = styled.span<Props>`
|
||||
: props.type === "danger"
|
||||
? props.theme.brand.red
|
||||
: props.theme.text};
|
||||
font-size: ${(props) =>
|
||||
props.size === "xlarge"
|
||||
? "26px"
|
||||
: props.size === "large"
|
||||
? "18px"
|
||||
: props.size === "medium"
|
||||
? "16px"
|
||||
: props.size === "small"
|
||||
? "14px"
|
||||
: props.size === "xsmall"
|
||||
? "13px"
|
||||
: "inherit"};
|
||||
${(props) => textSizeStyles(props.size)}
|
||||
|
||||
${(props) =>
|
||||
props.weight &&
|
||||
|
||||
Reference in new issue
Block a user