Skip to content

Commit

Permalink
feat: add merge date to Last Pull Request card
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvogt committed Dec 22, 2024
1 parent 40a094e commit 15ab83f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion theme/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-theme-chrisvogt",
"description": "My personal blog and website.",
"version": "0.33.1",
"version": "0.33.2",
"author": "Chris Vogt <[email protected]> (https://www.chrisvogt.me)",
"main": "index.js",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ exports[`GitHub Widget matches the loading state snapshot 1`] = `
}
/>
<div
className="css-5cryjx"
className="css-b5lvlf"
>
<div
className="text-row show-loading-animation"
Expand All @@ -447,7 +447,7 @@ exports[`GitHub Widget matches the loading state snapshot 1`] = `
"height": "15px",
"marginTop": 0,
"maxHeight": undefined,
"width": "15px",
"width": "250px",
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`Widget/GitHub/LastPullRequest snapshots matches the loading state snaps
}
/>
<div
className="css-1x5vc5t"
className="css-1c6hy0j"
>
<div
className="text-row show-loading-animation"
Expand All @@ -38,7 +38,7 @@ exports[`Widget/GitHub/LastPullRequest snapshots matches the loading state snaps
"height": "15px",
"marginTop": 0,
"maxHeight": undefined,
"width": "15px",
"width": "250px",
}
}
/>
Expand Down Expand Up @@ -79,8 +79,12 @@ exports[`Widget/GitHub/LastPullRequest snapshots matches the repository variant
</em>
</span>
<div
className="css-1x5vc5t"
className="css-1c6hy0j"
>
<span>
Merged
NaN years ago
</span>
<span>
<svg
aria-hidden="true"
Expand Down
8 changes: 5 additions & 3 deletions theme/src/components/widgets/github/last-pull-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { Themed } from '@theme-ui/mdx'
import { Box, Card, Heading } from '@theme-ui/components'
import Placeholder from 'react-placeholder'
import { TextRow } from 'react-placeholder/lib/placeholders'
import ago from 's-ago'

import CardFooter from '../card-footer'
import ViewExternal from '../view-external'

const LastPullRequest = ({ isLoading, pullRequest = {} }) => {
const { number, repository: { name: repositoryName } = {}, title, url } = pullRequest
const { closedAt, number, repository: { name: repositoryName } = {}, title, url } = pullRequest

return (
<Box>
Expand Down Expand Up @@ -45,13 +46,14 @@ const LastPullRequest = ({ isLoading, pullRequest = {} }) => {
</span>
</Placeholder>

<CardFooter customStyles={{ justifyContent: 'flex-end' }}>
<CardFooter>
<Placeholder
color='#efefef'
customPlaceholder={<TextRow color='#efefef' style={{ marginTop: 0, width: '15px', height: '15px' }} />}
customPlaceholder={<TextRow color='#efefef' style={{ marginTop: 0, width: '250px', height: '15px' }} />}
ready={!isLoading}
showLoadingAnimation
>
<span>Merged {ago(new Date(closedAt))}</span>
<ViewExternal platform='GitHub' />
</Placeholder>
</CardFooter>
Expand Down

0 comments on commit 15ab83f

Please sign in to comment.