Skip to content

Commit

Permalink
Merge pull request #39 from carbonplan/design-cleanup
Browse files Browse the repository at this point in the history
Design nits
  • Loading branch information
Shane98c authored Jan 16, 2024
2 parents 4cd8ba9 + 9a2959c commit 804b740
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/charts/category-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const CategoryBar = ({
<Flex sx={{ gap: 3, alignItems: 'flex-end' }}>
<Box
sx={{
fontSize: 1,
fontSize: [1, 1, 1, 2],
fontFamily: 'mono',
letterSpacing: 'mono',
color: 'secondary',
Expand Down
12 changes: 6 additions & 6 deletions components/charts/detail-charts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import { Box, Flex, Badge } from 'theme-ui'
import { Row, Column } from '@carbonplan/components'
import { Box, Flex } from 'theme-ui'
import { Row, Column, Badge } from '@carbonplan/components'
import { alpha } from '@theme-ui/color'
import { COLORS, LABELS } from '../constants'
import { formatValue } from '../utils'
Expand Down Expand Up @@ -59,7 +59,7 @@ const DetailCharts = ({ issued, retired, isLoading, error }) => {
sx={{
justifyContent: 'space-between',
fontSize: 2,
mb: 1,
mb: [1, 1, 1, 2],
}}
>
{isLoading || error ? (
Expand All @@ -82,7 +82,9 @@ const DetailCharts = ({ issued, retired, isLoading, error }) => {
backgroundColor: COLORS[l],
}}
/>
<Box sx={{ fontSize: 1 }}>{LABELS.category[l]}</Box>
<Box sx={{ fontSize: [1, 1, 1, 2] }}>
{LABELS.category[l]}
</Box>
</Flex>
)}

Expand All @@ -91,8 +93,6 @@ const DetailCharts = ({ issued, retired, isLoading, error }) => {
color: isLoading || error ? 'primary' : COLORS[l],
backgroundColor:
isLoading || error ? 'muted' : alpha(COLORS[l], 0.3),
fontSize: 2,
mb: '3px',
}}
>
{isLoading || error
Expand Down
6 changes: 4 additions & 2 deletions components/clips.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Badge,
Tag,
Expander,
Link,
} from '@carbonplan/components'
import { RotatingArrow } from '@carbonplan/icons'
import { useMemo, useState } from 'react'
Expand Down Expand Up @@ -100,15 +101,16 @@ const Clip = ({ date, label, url, projects, source, index }) => {
{(projects.length <= 5 || expanded) && (
<Flex sx={{ gap: 2, flexWrap: 'wrap', mt: 3 }}>
{projects?.map(({ project_id, category }) => (
<a href={`/projects/${project_id}`} key={project_id}>
<Link href={`/projects/${project_id}`} key={project_id}>
<Badge
sx={{
color: COLORS[category[0]] ?? COLORS.other,
userSelect: 'text',
}}
>
{project_id}
</Badge>
</a>
</Link>
))}
</Flex>
)}
Expand Down
17 changes: 13 additions & 4 deletions components/project-row.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Badge, Button, Expander, Row } from '@carbonplan/components'
import { RotatingArrow } from '@carbonplan/icons'
import { RotatingArrow, Arrow } from '@carbonplan/icons'
import { keyframes } from '@emotion/react'
import { alpha } from '@theme-ui/color'
import { useState } from 'react'
Expand All @@ -22,6 +22,7 @@ const fade = keyframes({
const ProjectRow = ({ project }) => {
const { project_id, category, name, issued, retired } = project
const [expanded, setExpanded] = useState(false)
const [hoveredDetails, setHoveredDetails] = useState(false)
const color = COLORS[category[0]] ?? COLORS.other

const sx = {
Expand Down Expand Up @@ -67,6 +68,7 @@ const ProjectRow = ({ project }) => {
top: '2px', // centering, not ideal.
width: '18px',
height: '18px',
stroke: expanded ? alpha(color, 0.8) : 'secondary',
}}
/>
<Badge
Expand Down Expand Up @@ -121,21 +123,28 @@ const ProjectRow = ({ project }) => {
key: 'details',
label: (
<Badge
onMouseOver={() => setHoveredDetails(true)} // css hover selectors not working
onMouseOut={() => setHoveredDetails(false)} // for this context
sx={{
color: expanded ? color : null,
color: expanded || hoveredDetails ? color : null,
'&:hover #arrow': {
transform: 'rotate(45deg)',
},
}}
>
<Button
href={`/projects/${project_id}`}
onClick={(e) => e.stopPropagation()}
>
<RotatingArrow
<Arrow
id='arrow'
sx={{
mt: [1, 1, 1, 0],
mb: [0, 0, 0, '1px'],
width: 14,
height: 14,
color: expanded ? color : null,
color: expanded || hoveredDetails ? color : null,
transition: 'transform 0.15s',
}}
/>
</Button>
Expand Down

1 comment on commit 804b740

@vercel
Copy link

@vercel vercel bot commented on 804b740 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

offsets-db-web – ./

offsets-db-web-carbonplan.vercel.app
offsets-db-web.vercel.app
offsets-db-web-git-main-carbonplan.vercel.app

Please sign in to comment.