Skip to content

Commit

Permalink
More styles and theme updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
cimigree committed Jan 20, 2025
1 parent 040fa77 commit d6dd760
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
19 changes: 19 additions & 0 deletions src/renderer/src/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createTheme } from '@mui/material/styles'
import {
ALMOST_BLACK,
COMAPEO_BLUE,
DARKER_ORANGE,
DARK_COMAPEO_BLUE,
DARK_GREY,
DARK_ORANGE,
Expand All @@ -13,6 +14,12 @@ import {
WHITE,
} from './colors'

declare module '@mui/material/Button' {
interface ButtonPropsVariantOverrides {
darkOrange: true
}
}

const theme = createTheme({
typography: {
fontFamily: 'Rubik, sans-serif',
Expand Down Expand Up @@ -72,6 +79,18 @@ const theme = createTheme({
},
components: {
MuiButton: {
variants: [
{
props: { variant: 'darkOrange' },
style: {
backgroundColor: DARK_ORANGE,
color: WHITE,
'&:hover': {
backgroundColor: DARKER_ORANGE,
},
},
},
],
defaultProps: {
variant: 'contained',
},
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const VERY_LIGHT_GREY = '#ededed'

export const ORANGE = '#FF9933'
export const DARK_ORANGE = '#E86826'
export const DARKER_ORANGE = '#D95F28'

export const GREEN = '#59A553'
export const RED = '#D92222'
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {
type MouseEventHandler,
type PropsWithChildren,
} from 'react'
import { Button as MuiButton } from '@mui/material'
import { Button as MuiButton, type ButtonProps } from '@mui/material'

type CustomButtonProps = PropsWithChildren<{
name?: string
className?: string
color?: 'primary' | 'secondary' | 'success' | 'error'
color?: ButtonProps['color']
size?: 'medium' | 'large' | 'fullWidth'
testID?: string
variant?: 'contained' | 'outlined' | 'text'
variant?: 'contained' | 'outlined' | 'text' | 'darkOrange'
style?: CSSProperties
onClick?: MouseEventHandler<HTMLButtonElement>
disabled?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const PhotoContainer = styled('img')({

export function ObservationListItem({ observation, onClick }: Props) {
const projectId = useActiveProjectIdStoreState((s) => s.activeProjectId)
// TODO: Ideally, the fallback shouldn't be necessary
const preset = useObservationWithPreset(observation, projectId ?? '')
const createdAt = observation.createdAt
? new Date(observation.createdAt)
Expand All @@ -54,10 +55,10 @@ export function ObservationListItem({ observation, onClick }: Props) {
return (
<Container onClick={onClick}>
<TextContainer>
<Text style={{ fontWeight: 500 }}>
<Text bold>
<FormattedPresetName preset={preset} />
</Text>
<Text style={{ fontSize: 10, fontWeight: 400 }}>
<Text kind="caption">
<FormattedDate
value={createdAt}
month="short"
Expand Down
22 changes: 12 additions & 10 deletions src/renderer/src/components/Observations/ObservationListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Observation, Track } from '@comapeo/schema'
import { styled } from '@mui/material/styles'
import { defineMessages, useIntl } from 'react-intl'

import { ALMOST_BLACK, DARK_ORANGE, VERY_LIGHT_GREY, WHITE } from '../../colors'
import { ALMOST_BLACK, VERY_LIGHT_GREY, WHITE } from '../../colors'
import AddPersonIcon from '../../images/AddPerson.svg'
import LightningIcon from '../../images/Lightning.svg'
import { Button } from '../Button'
Expand Down Expand Up @@ -71,12 +71,8 @@ export function ObservationListView({
<ContentWrapper>
<ButtonsRow>
<Button
variant="contained"
style={{
backgroundColor: DARK_ORANGE,
color: WHITE,
minWidth: 170,
}}
variant="darkOrange"
style={{ flex: 1 }}
startIcon={<LightningIcon color={WHITE} width={16} height={16} />}
onClick={onViewExchange}
>
Expand All @@ -87,7 +83,7 @@ export function ObservationListView({
style={{
borderColor: VERY_LIGHT_GREY,
color: ALMOST_BLACK,
minWidth: 170,
flex: 1,
}}
startIcon={
<AddPersonIcon fill={ALMOST_BLACK} width={16} height={16} />
Expand All @@ -109,13 +105,19 @@ export function ObservationListView({
<ObservationListItem
key={item.docId}
observation={item}
onClick={() => onSelectObservation?.(item.docId)}
onClick={
onSelectObservation
? () => onSelectObservation(item.docId)
: undefined
}
/>
) : (
<TrackListItem
key={item.docId}
track={item}
onClick={() => onSelectTrack?.(item.docId)}
onClick={
onSelectTrack ? () => onSelectTrack(item.docId) : undefined
}
/>
)}
</li>
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import {
import Typography from '@mui/material/Typography'
import { type Variant } from '@mui/material/styles/createTypography'

type Kind = 'title' | 'subtitle' | 'body'
type Kind = 'title' | 'subtitle' | 'body' | 'caption'

type TextColor = 'primary' | 'secondary' | 'disabled'

const kindToVariant: { [k in Kind]: Variant } = {
title: 'h1',
subtitle: 'subtitle1',
body: 'body1',
caption: 'caption',
} as const

const textColorToTypographyColor: {
Expand Down

0 comments on commit d6dd760

Please sign in to comment.