diff --git a/src/components/DeviceStatistics.tsx b/src/components/DeviceStatistics.tsx index 9477113a..698f9173 100644 --- a/src/components/DeviceStatistics.tsx +++ b/src/components/DeviceStatistics.tsx @@ -5,8 +5,6 @@ import clsx from 'clsx' import { getDeviceStats } from '~/api/devices' import { formatDistance, formatDuration } from '~/utils/date' -import Typography from '~/components/material/Typography' - type DeviceStatisticsProps = { class?: string dongleId: string @@ -19,28 +17,18 @@ const DeviceStatistics: VoidComponent = (props) => { return (
- - Distance - - - {formatDistance(allTime()?.distance)} - + Distance + {formatDistance(allTime()?.distance)}
- - Duration - - - {formatDuration(allTime()?.minutes)} - + Duration + {formatDuration(allTime()?.minutes)}
- - Routes - - {allTime()?.routes ?? 0} + Routes + {allTime()?.routes ?? 0}
) diff --git a/src/components/RouteStaticMap.tsx b/src/components/RouteStaticMap.tsx index 8bfa23d6..d8e83d5d 100644 --- a/src/components/RouteStaticMap.tsx +++ b/src/components/RouteStaticMap.tsx @@ -8,7 +8,6 @@ import { getThemeId } from '~/theme' import type { Route } from '~/types' import Icon from '~/components/material/Icon' -import Typography from '~/components/material/Typography' const loadImage = (url: string | undefined): Promise => { if (!url) { @@ -46,7 +45,7 @@ const State = (props: { props.opaque && 'bg-surface text-on-surface', )} > - {props.children} + {props.children} {props.trailing} ) diff --git a/src/components/RouteStatistics.tsx b/src/components/RouteStatistics.tsx index adb3420e..e3317a2c 100644 --- a/src/components/RouteStatistics.tsx +++ b/src/components/RouteStatistics.tsx @@ -6,8 +6,6 @@ import { TimelineStatistics, getTimelineStatistics } from '~/api/derived' import type { Route } from '~/types' import { formatRouteDistance, formatRouteDuration } from '~/utils/date' -import Typography from '~/components/material/Typography' - const formatEngagement = (timeline?: TimelineStatistics): string => { if (!timeline) return '' const { engagedDuration, duration } = timeline @@ -29,42 +27,26 @@ const RouteStatistics: VoidComponent = (props) => { return (
- - Distance - - - {formatRouteDistance(props.route)} - + Distance + {formatRouteDistance(props.route)}
- - Duration - - - {formatRouteDuration(props.route)} - + Duration + {formatRouteDuration(props.route)}
- - Engaged - + Engaged - - {formatEngagement(timeline())} - + {formatEngagement(timeline())}
- - User flags - + User flags - - {formatUserFlags(timeline())} - + {formatUserFlags(timeline())}
diff --git a/src/components/material/Button.tsx b/src/components/material/Button.tsx index b8be359e..f7504431 100644 --- a/src/components/material/Button.tsx +++ b/src/components/material/Button.tsx @@ -3,7 +3,6 @@ import { splitProps } from 'solid-js' import clsx from 'clsx' import ButtonBase, { ButtonBaseProps } from './ButtonBase' -import Typography from './Typography' type ButtonProps = ButtonBaseProps & { color?: 'primary' | 'secondary' | 'tertiary' | 'error' @@ -42,7 +41,7 @@ const Button: ParentComponent = (props) => { {...rest} > {props.leading} - {props.children} + {props.children} {props.trailing} ) diff --git a/src/components/material/Card.tsx b/src/components/material/Card.tsx index d884294d..87e340d1 100644 --- a/src/components/material/Card.tsx +++ b/src/components/material/Card.tsx @@ -2,7 +2,6 @@ import type { ParentComponent, JSXElement, VoidComponent } from 'solid-js' import clsx from 'clsx' import ButtonBase from '~/components/material/ButtonBase' -import Typography from '~/components/material/Typography' type CardHeaderProps = { class?: string @@ -19,12 +18,8 @@ export const CardHeader: VoidComponent = (props) => { > {props.leading}
- {props.headline && ( - {props.headline} - )} - {props.subhead && ( - {props.subhead} - )} + {props.headline && {props.headline}} + {props.subhead && {props.subhead}}
{props.trailing} @@ -40,12 +35,8 @@ type CardHeadlineProps = { export const CardHeadline: VoidComponent = (props) => { return (
- {props.title && {props.title}} - {props.subhead && ( - - {props.subhead} - - )} + {props.title && {props.title}} + {props.subhead && {props.subhead}}
) } @@ -55,11 +46,7 @@ type CardContentProps = { } export const CardContent: ParentComponent = (props) => { - return ( -
- {props.children} -
- ) + return
{props.children}
} type CardTextContentProps = { @@ -71,9 +58,7 @@ export const CardTextContent: ParentComponent = ( ) => { return (
- - {props.children} - + {props.children}
) } @@ -83,11 +68,7 @@ type CardActionsProps = { } export const CardActions: ParentComponent = (props) => { - return ( -
- {props.children} -
- ) + return
{props.children}
} type CardProps = { diff --git a/src/components/material/FloatingActionButton.tsx b/src/components/material/FloatingActionButton.tsx index 557e3689..6732a117 100644 --- a/src/components/material/FloatingActionButton.tsx +++ b/src/components/material/FloatingActionButton.tsx @@ -2,7 +2,6 @@ import type { JSXElement, ParentComponent } from 'solid-js' import clsx from 'clsx' import ButtonBase, { ButtonBaseProps } from '~/components/material/ButtonBase' -import Typography from '~/components/material/Typography' type FloatingActionButtonProps = ButtonBaseProps & { leading?: JSXElement @@ -20,7 +19,7 @@ const FloatingActionButton: ParentComponent = ( onClick={props.onClick} > {props.leading} - {props.children} + {props.children} ) } diff --git a/src/components/material/List.tsx b/src/components/material/List.tsx index 565f04dd..39888807 100644 --- a/src/components/material/List.tsx +++ b/src/components/material/List.tsx @@ -2,7 +2,6 @@ import type { JSXElement, ParentComponent, VoidComponent } from 'solid-js' import clsx from 'clsx' import ButtonBase from '~/components/material/ButtonBase' -import Typography from '~/components/material/Typography' type ListItemContentProps = { headline: JSXElement @@ -12,14 +11,8 @@ type ListItemContentProps = { export const ListItemContent: VoidComponent = (props) => { return (
- - {props.headline} - - {props.subhead && ( - - {props.subhead} - - )} +
{props.headline}
+ {props.subhead &&
{props.subhead}
}
) } diff --git a/src/components/material/NavigationBar.tsx b/src/components/material/NavigationBar.tsx index 24d803f1..318aecee 100644 --- a/src/components/material/NavigationBar.tsx +++ b/src/components/material/NavigationBar.tsx @@ -3,7 +3,6 @@ import { A } from '@solidjs/router' import clsx from 'clsx' import Icon, { IconProps } from '~/components/material/Icon' -import Typography from '~/components/material/Typography' type NavigationBarItemProps = { icon: IconProps['children'] @@ -25,9 +24,9 @@ export const NavigationBarItem: ParentComponent = ( {props.icon} - +
{props.children} - +
) } diff --git a/src/components/material/TopAppBar.tsx b/src/components/material/TopAppBar.tsx index 6ff5442c..a3ef8031 100644 --- a/src/components/material/TopAppBar.tsx +++ b/src/components/material/TopAppBar.tsx @@ -1,13 +1,12 @@ import type { JSXElement, ParentComponent } from 'solid-js' +import { Dynamic } from 'solid-js/web' import clsx from 'clsx' -import Typography from '~/components/material/Typography' - type TopAppBarProps = { class?: string leading?: JSXElement trailing?: JSXElement - as?: string + component?: string } const TopAppBar: ParentComponent = (props) => { @@ -19,9 +18,9 @@ const TopAppBar: ParentComponent = (props) => { )} > {props.leading} - + {props.children} - + {props.trailing} ) diff --git a/src/components/material/Typography.tsx b/src/components/material/Typography.tsx deleted file mode 100644 index 4735f228..00000000 --- a/src/components/material/Typography.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import type { ParentComponent } from 'solid-js' -import { Dynamic } from 'solid-js/web' -import clsx from 'clsx' - -export type TypographyProps = { - class?: string - color?: - | 'inherit' - | 'on-surface' - | 'on-surface-variant' - | 'on-primary' - | 'on-secondary' - | 'on-tertiary' - variant?: - | 'display-lg' - | 'display-md' - | 'display-sm' - | 'headline-lg' - | 'headline-md' - | 'headline-sm' - | 'title-lg' - | 'title-md' - | 'title-sm' - | 'label-lg' - | 'label-md' - | 'label-sm' - | 'body-lg' - | 'body-md' - | 'body-sm' - weight?: - | 'thin' - | 'extra-light' - | 'light' - | 'regular' - | 'medium' - | 'semi-bold' - | 'bold' - | 'extra-bold' - | 'black' - as?: string -} - -const Typography: ParentComponent = (props) => { - // TODO: letter spacing - const variant = () => props.variant || 'body-md' - const styles = () => - ({ - 'display-lg': 'font-sans text-[57px] leading-[64px]', - 'display-md': 'font-sans text-[45px] leading-[52px]', - 'display-sm': 'font-sans text-[36px] leading-[44px]', - 'headline-lg': 'font-sans text-[32px] leading-[40px]', - 'headline-md': 'font-sans text-[28px] leading-[36px]', - 'headline-sm': 'font-sans text-[24px] leading-[32px]', - 'title-lg': 'font-sans text-[22px] leading-[28px]', - 'title-md': 'font-sans text-[16px] leading-[24px]', - 'title-sm': 'font-sans text-[14px] leading-[20px]', - 'label-lg': 'font-mono text-[14px] leading-[20px] uppercase', - 'label-md': 'font-mono text-[12px] leading-[16px] uppercase', - 'label-sm': 'font-mono text-[11px] leading-[16px] uppercase', - 'body-lg': 'font-sans text-[16px] leading-[24px]', - 'body-md': 'font-sans text-[14px] leading-[20px]', - 'body-sm': 'font-sans text-[12px] leading-[16px]', - }[variant()]) - - const variantWeight = () => - ({ - 'display-lg': 'regular', - 'display-md': 'regular', - 'display-sm': 'regular', - 'headline-lg': 'regular', - 'headline-md': 'regular', - 'headline-sm': 'regular', - 'title-lg': 'regular', - 'title-md': 'medium', - 'title-sm': 'medium', - 'label-lg': 'medium', - 'label-md': 'medium', - 'label-sm': 'medium', - 'body-lg': 'regular', - 'body-md': 'regular', - 'body-sm': 'regular', - }[variant()]) - - const weight = () => props.weight || variantWeight() - const weightStyles = () => - ({ - light: 'font-light', - regular: 'font-regular', - medium: 'font-medium', - 'semi-bold': 'font-semibold', - bold: 'font-bold', - 'extra-bold': 'font-extrabold', - }[weight() || variantWeight()]) - - const color = () => props.color || 'inherit' - const colorStyles = () => - ({ - inherit: '', - 'on-surface': 'text-on-surface', - 'on-surface-variant': 'text-on-surface-variant', - 'on-primary': 'text-on-primary', - 'on-secondary': 'text-on-secondary', - 'on-tertiary': 'text-on-tertiary', - }[color()]) - - return ( - - {props.children} - - ) -} - -export default Typography diff --git a/src/pages/auth/login.tsx b/src/pages/auth/login.tsx index 4f8d079a..a27036e5 100644 --- a/src/pages/auth/login.tsx +++ b/src/pages/auth/login.tsx @@ -2,7 +2,6 @@ import { getGoogleAuthUrl, getAppleAuthUrl, getGitHubAuthUrl } from '~/api/auth' import { setAccessToken } from '~/api/auth/client' import Button from '~/components/material/Button' -import Typography from '~/components/material/Typography' export default function Login() { const loginAsDemoUser = function () { @@ -21,18 +20,8 @@ export default function Login() { />
- - comma connect - - - - Manage your openpilot experience. - +

comma connect

+

Manage your openpilot experience.

@@ -84,10 +73,10 @@ export default function Login() {
- +

Make sure to sign in with the same account if you have previously paired your comma three. - +

arrow_back} > comma connect - +

Devices - +

{(devices: Device[]) => } diff --git a/src/pages/dashboard/activities/DeviceActivity.tsx b/src/pages/dashboard/activities/DeviceActivity.tsx index 73ac2829..f47638f0 100644 --- a/src/pages/dashboard/activities/DeviceActivity.tsx +++ b/src/pages/dashboard/activities/DeviceActivity.tsx @@ -5,7 +5,6 @@ import { getDevice } from '~/api/devices' import IconButton from '~/components/material/IconButton' import TopAppBar from '~/components/material/TopAppBar' -import Typography from '~/components/material/Typography' import DeviceStatistics from '~/components/DeviceStatistics' import { getDeviceName } from '~/utils/device' @@ -35,7 +34,7 @@ const DeviceActivity: VoidComponent = (props) => {
- Routes + Routes
diff --git a/src/pages/dashboard/activities/RouteActivity.tsx b/src/pages/dashboard/activities/RouteActivity.tsx index 73361da8..d4aa35f7 100644 --- a/src/pages/dashboard/activities/RouteActivity.tsx +++ b/src/pages/dashboard/activities/RouteActivity.tsx @@ -10,7 +10,6 @@ import { getRoute } from '~/api/route' import IconButton from '~/components/material/IconButton' import TopAppBar from '~/components/material/TopAppBar' -import Typography from '~/components/material/Typography' import RouteStaticMap from '~/components/RouteStaticMap' import RouteStatistics from '~/components/RouteStatistics' @@ -47,9 +46,7 @@ const RouteActivity: VoidComponent = (props) => {
- - Timeline - +

Timeline

}> @@ -57,9 +54,7 @@ const RouteActivity: VoidComponent = (props) => {
- - Route Map - +

Route Map

}> diff --git a/src/pages/dashboard/components/DeviceList.tsx b/src/pages/dashboard/components/DeviceList.tsx index ad99ef2c..2012dfb4 100644 --- a/src/pages/dashboard/components/DeviceList.tsx +++ b/src/pages/dashboard/components/DeviceList.tsx @@ -5,7 +5,6 @@ import clsx from 'clsx' import Icon from '~/components/material/Icon' import List, { ListItem, ListItemContent } from '~/components/material/List' -import Typography from '~/components/material/Typography' import type { Device } from '~/types' import { getDeviceName } from '~/utils/device' @@ -37,9 +36,9 @@ const DeviceList: VoidComponent = (props) => { + {device.dongle_id} - + } /> diff --git a/tailwind.config.ts b/tailwind.config.ts index 69920035..ce2f67f1 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -80,6 +80,65 @@ export default { sans: ['Inter', ...defaultTheme.fontFamily.sans], mono: ['JetBrains Mono', ...defaultTheme.fontFamily.mono], }, + fontSize: { + 'display-lg': ['57px', { + lineHeight: '64px', + letterSpacing: '-0.25px', + }], + 'display-md': ['45px', { + lineHeight: '52px', + }], + 'display-sm': ['36px', { + lineHeight: '44px', + }], + 'headline-lg': ['32px', { + lineHeight: '40px', + }], + 'headline-md': ['28px', { + lineHeight: '36px', + }], + 'headline-sm': ['24px', { + lineHeight: '32px', + }], + 'title-lg': ['22px', { + lineHeight: '28px', + }], + 'title-md': ['16px', { + lineHeight: '24px', + fontWeight: 500, + letterSpacing: '0.15px', + }], + 'title-sm': ['14px', { + lineHeight: '20px', + fontWeight: 500, + letterSpacing: '0.1px', + }], + 'label-lg': ['14px', { + lineHeight: '20px', + fontWeight: 500, + }], + 'label-md': ['12px', { + lineHeight: '18px', + fontWeight: 500, + }], + 'label-sm': ['11px', { + lineHeight: '16px', + fontWeight: 500, + letterSpacing: '0.5px', + }], + 'body-lg': ['16px', { + lineHeight: '24px', + letterSpacing: '0.5px', + }], + 'body-md': ['14px', { + lineHeight: '20px', + letterSpacing: '0.25px', + }], + 'body-sm': ['12px', { + lineHeight: '16px', + letterSpacing: '0.4px', + }], + }, keyframes: { ripple: { '100%': {