Skip to content

Commit

Permalink
styled last edited
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Huggett committed Jul 30, 2020
1 parent 36daf13 commit 6e54196
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
9 changes: 4 additions & 5 deletions components/ui/LastEdited.tsx
Expand Up @@ -15,11 +15,10 @@ export const LastEdited = styled(({
</p>
)
})`
font-size: 10.5rem;
color: blue;
margin-top: 2rem !important;
font-size: 1rem !important;
color: inherit;
opacity: 0.5;
`


27 changes: 13 additions & 14 deletions utils/useLastEdited.ts
@@ -1,22 +1,21 @@
import { useCMS } from "tinacms"
import { useEffect } from "react"
import createDecorator from "final-form-calculate"
import { formatDate } from "./blog_helpers"


export function useLastEdited(form) {
const cms = useCMS()
const cms = useCMS()

useEffect(() => {
if (cms.disabled) { return }
const decorator = createDecorator(
{
field: /.*/,
updates: {
'frontmatter.last_edited': () => (new Date()).toISOString()
}
}
)
return decorator(form.finalForm)
}, [form.id])
useEffect(() => {
if (cms.disabled) { return }
const decorator = createDecorator(
{
field: /.*/,
updates: {
'frontmatter.last_edited': () => (new Date()).toISOString()
}
}
)
return decorator(form.finalForm)
}, [form.id])
}

0 comments on commit 6e54196

Please sign in to comment.