Skip to content

Commit

Permalink
checkpoint: feat: update font sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-dane committed Nov 10, 2024
1 parent 22f01d5 commit ea4c933
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 39 deletions.
10 changes: 8 additions & 2 deletions packages/web/src/common/styles/default-theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ declare module "styled-components" {
};
};
text: {
default: string;
medium: string;
xs: string;
s: string;
m: string;
l: string;
xl: string;
xxl: string;
xxxl: string;
"4xl": string;
};
transition: {
default: string;
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/common/styles/style.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type FontSize = "xs" | "s" | "m" | "l" | "xl" | "xxl" | "xxxl" | "4xl";
12 changes: 9 additions & 3 deletions packages/web/src/common/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const c = {
blue100: "hsl(202 100 67)",
blueGray400: "hsl(207 14 57)",
blueGray300: "hsl(205 33 61)",
blueGray200: "hsl(205 36 56)",
blueGray200: "hsl(205 36 62)",
blueGray100: "hsl(196 45 78)",
darkBlue500: "hsl(220 29 6)",
darkBlue400: "hsl(222 28 7)",
Expand Down Expand Up @@ -81,8 +81,14 @@ export const theme: DefaultTheme = {
},
},
text: {
default: "0.8125rem",
medium: "1rem",
xs: "0.563rem",
s: "0.688rem",
m: "0.8125rem",
l: "1rem",
xl: "1.125rem",
xxl: "1.3rem",
xxxl: "1.6rem",
"4xl": "1.7rem",
},
transition: {
default: "0.3s",
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/Flex/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum JustifyContent {

export enum AlignItems {
CENTER = "center",
BASELINE = "baseline",
FLEX_END = "flex-end",
FLEX_START = "flex-start",
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/Input/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const StyledInput = styled.input<Props>`
background-color: ${({ bgColor }) => bgColor};
border: none;
height: 34px;
font-size: ${({ theme }) => theme.text.medium};
font-size: ${({ theme }) => theme.text.l};
outline: none;
width: 100%;
Expand Down
9 changes: 6 additions & 3 deletions packages/web/src/components/Text/styled.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import styled from "styled-components";
import { getGradient, blueGradient } from "@web/common/styles/theme.util";
import { FontSize } from "@web/common/styles/style.types";
import { theme } from "@web/common/styles/theme";

export interface Props {
bgColor?: string;
color?: string;
cursor?: string;
fontWeight?: number | "normal" | "bold" | "bolder" | "lighter";
lineHeight?: number;
size?: number;
size?: FontSize;
withGradient?: boolean;
withUnderline?: boolean;
zIndex?: number;
}

// size && font-size: ${theme.text[size] || size};`} //TODO fallback to m */
export const StyledText = styled.span<Props>`
${({ color }) => color && `color: ${color};`}
${({ cursor }) => cursor && `cursor: ${cursor};`}
${({ lineHeight }) => lineHeight && `line-height: ${lineHeight}px;`}
${({ size }) => size && `font-size: ${size}px;`}
${({ size }) => size && `font-size: ${theme.text[size] || "5px"};`}
font-weight: ${({ fontWeight = "normal" }) => fontWeight};
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/TimePicker/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Props {
}

export const StyledTimePicker = styled.div<Props>`
font-size: ${({ theme }) => theme.text.medium};
font-size: ${({ theme }) => theme.text.l};
min-width: 90px;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Props {

export const TooltipDescription: FC<Props> = ({ description }) => {
return (
<Text size={11} style={{ paddingRight: 10 }}>
<Text size="m" style={{ paddingRight: 10 }}>
{description}
</Text>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/Tooltip/TooltipWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const TooltipWrapper: React.FC<Props> = ({
{description && <TooltipDescription description={description} />}
{shortcut && (
<StyledShortcutTip>
<Text size={12}>{shortcut}</Text>
<Text size="m">{shortcut}</Text>
</StyledShortcutTip>
)}
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ const _GridEvent = (
direction={FlexDirections.COLUMN}
flexWrap={FlexWrap.WRAP}
>
<StyledEventTitle size={10.3} role="textbox">
<StyledEventTitle size={"m"} role="textbox">
{event.title}
</StyledEventTitle>
{!event.isAllDay && (
<>
<Times
event={event}
isDrafting={isDragging || isResizing}
isDrafting={isDraft}
isPlaceholder={isPlaceholder}
/>
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export const Times: React.FC<Props> = ({
const [isHovered, setIsHovered] = useState(false);
const [isTimesShown, setIsTimesShown] = useState(event.isTimesShown);

const SIZE = 10;
const shouldRevealBox = isPlaceholder && !isTimesShown && !isDrafting;
const shouldRevealBox = !isPlaceholder && !isTimesShown && !isDrafting;

const toggleTimes = (e: React.MouseEvent) => {
e.stopPropagation();
Expand All @@ -52,9 +51,8 @@ export const Times: React.FC<Props> = ({
onMouseDown={toggleTimes}
>
<Text
lineHeight={SIZE}
role="textbox"
size={SIZE}
size="xs"
title="Click to hide times"
zIndex={ZIndex.LAYER_3}
>
Expand All @@ -65,9 +63,8 @@ export const Times: React.FC<Props> = ({
<StyledTimes revealBox={shouldRevealBox}>
{isHovered && shouldRevealBox ? (
<Text
lineHeight={SIZE}
onMouseDown={toggleTimes}
size={SIZE}
size="xs"
role="textbox"
title="Click to show times"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ export const GridEventPreview: FC<Props> = memo(function GridEventPreview({
width={width}
>
<Flex alignItems={AlignItems.CENTER} flexWrap={FlexWrap.WRAP}>
<Text size={12} role="textbox">
<Text size="m" role="textbox">
{event.title}
</Text>

{isOverMainGrid && (
<>
<SpaceCharacter />
<Text size={10}>{getTimePreview()}</Text>
<Text size="s">{getTimePreview()}</Text>
</>
)}
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const AllDayEvent = ({
alignItems={AlignItems.FLEX_START}
direction={FlexDirections.COLUMN}
>
<Text size={10.3} role="textbox">
<Text size="m" role="textbox">
{event.title}
<SpaceCharacter />
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const TimesColumn = () => {
<StyledDayTimes>
{hourLabels.map((label, index) => (
<StyledTimesLabel color={colors[index]} key={`${label}-${index}`}>
<Text size={9}>{label}</Text>
<Text size="xs">{label}</Text>
</StyledTimesLabel>
))}
</StyledDayTimes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,11 @@ export const DayLabels: FC<Props> = ({
title={getWeekDayLabel(day)}
color={color}
>
<Text
lineHeight={WEEK_DAYS_HEIGHT}
size={WEEK_DAYS_HEIGHT}
withGradient={isToday}
>
<Text size="xxl" withGradient={isToday}>
{dayNumber}
</Text>
<SpaceCharacter />
<Text size={12}>{day.format("ddd")}</Text>
<Text size="l">{day.format("ddd")}</Text>
</StyledWeekDayFlex>
);
})}
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/views/Calendar/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ export const Header: FC<Props> = ({
>
<StyledLeftGroup>
<StyledHeaderLabel aria-level={1} role="heading">
<Text size={40}>{startOfView.format("MMMM")}</Text>
<Text size="4xl">{startOfView.format("MMMM")}</Text>

<SpaceCharacter />

<Text size={38}>{startOfView.format("YYYY")}</Text>
<Text size="xxxl">{startOfView.format("YY")}</Text>
</StyledHeaderLabel>

<StyledNavigationButtons>
Expand Down
3 changes: 1 addition & 2 deletions packages/web/src/views/Calendar/components/Header/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ export const StyledHeaderLabel = styled.div`
`;

export const StyledLeftGroup = styled(Flex)`
align-items: ${AlignItems.CENTER};
align-items: ${AlignItems.BASELINE};
`;

export const StyledHeaderRow = styled(Flex)`
align-items: ${AlignItems.CENTER};
color: ${({ theme }) => theme.color.text.light};
font-size: 40px;
justify-content: ${JustifyContent.SPACE_BETWEEN};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const SomedayEventRectangle = ({
direction={FlexDirections.ROW}
justifyContent={JustifyContent.SPACE_BETWEEN}
>
<Text size={15}>{event.title}</Text>
<Text size="l">{event.title}</Text>

{canMigrate ? (
<Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const RepeatDialog: FC<Props> = ({
setIsRepeat(false);
};

const fontSize = theme.text.default;
const fontSize = theme.text.m;
const bgBright = brighten(bgColor);
const bgDark = darken(bgColor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props {
export const StyledRepeatText = styled.span<Props>`
border: 1px solid transparent;
border-radius: 3px;
font-size: ${({ theme }) => theme.text.default};
font-size: ${({ theme }) => theme.text.m};
opacity: ${({ hasRepeat }) => !hasRepeat && 0.85};
padding: 2px 8px;
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/views/NotFound/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const NotFoundView = () => {
return (
<StyledNotFoundContainer>
<div>
<Text size={38}>🏴‍☠️ Shiver me timbers! </Text>
<Text size="4xl">🏴‍☠️ Shiver me timbers! </Text>
</div>

<div>
<Text size={22}>This isn't part of the app, matey</Text>
<Text size="xxl">This isn't part of the app, matey</Text>
</div>

<StyledBackButton onClick={goHome}>
Expand Down

0 comments on commit ea4c933

Please sign in to comment.