Discussion about date field changes and using emojis as icons in Sanity.io
7 replies
Last updated: Apr 2, 2021
R
Hey, are there any changes to the date field? I have the following:
Also in the subtitle iām seeing something else:
type: 'date',
options: {
dateFormat: 'YYYY-MM',
},however the dateFormat is not being respected and Iām getting
date:Ā "2021-04-01T07:00:00.000Z"which is strange, because older documents have
date:Ā "2021-04"in the front end.
Also in the subtitle iām seeing something else:
Apr 1, 2021, 7:27 PM
R
Hey there! It looks like changes to date and dateTime happened in in
v2.6.3. Hereās an overview.
Apr 1, 2021, 8:23 PM
J
user S
In your schema, this should work:export default { name: 'Example Schema', type: 'document', fields: [ // Your schema fields ], preview: { select: { media: 'š' } } }
https://www.sanity.io/docs/previews-list-views 2) https://www.sanity.io/docs/icons-for-data-types 3) https://www.sanity.io/docs/customization
Apr 2, 2021, 12:16 AM
Thatās awesome. I wonder if this can be used in the structure builder too using
.icon(...)
Apr 2, 2021, 12:21 AM
R
Itās mentioned here although I personally couldnāt seem to get it working the other dayā¦
Apr 2, 2021, 12:23 AM
R
user S
check this š. You. can also make a file icons.js and export them all from there, you know the drill. I like this approach cuz you can add css to align them nicely.import S from '@sanity/desk-tool/structure-builder'
import React from 'react'
import Emoji from 'a11y-react-emoji'
// Icons
const IconInformation = () => (
<Emoji style={{ fontSize: '1.5rem' }} symbol=":tophat:" />
)
const IconHome = () => <Emoji style={{ fontSize: '1.5rem' }} symbol=":house_with_garden:" />
const IconSelectedWork = () => (
<Emoji style={{ fontSize: '1.5rem' }} symbol=":star:" />
)
const IconSiteSettings = () => (
<Emoji style={{ fontSize: '1.5rem' }} symbol=":gear:" />
)
const IconClients = () => <Emoji style={{ fontSize: '1.5rem' }} symbol=":champagne:" />
const IconNavigation = () => (
<Emoji style={{ fontSize: '1.5rem' }} symbol=":compass:" />
)
const hiddenDocTypes = (listItem) =>
![
'home',
'information',
'siteSettings',
'selectedWork',
'clients',
'navigation',
].includes(listItem.getId())
export default () =>
S.list()
.title('Content')
.items([
...S.documentTypeListItems().filter(hiddenDocTypes),
S.listItem()
.title('Selected Work')
.icon(IconSelectedWork)
.child(
S.editor()
.id('selectedWork')
.schemaType('selectedWork')
.documentId('selectedWork')
),
S.divider(),
S.listItem()
.title('Navigation Content')
.icon(IconNavigation)
.child(
S.editor()
.id('navigation')
.schemaType('navigation')
.documentId('navigation')
),
S.divider(),
S.listItem()
.title('Site Settings')
.icon(IconSiteSettings)
.child(
S.editor()
.id('siteSettings')
.schemaType('siteSettings')
.documentId('siteSettings')
),
S.divider(),
S.listItem()
.title('Home')
.icon(IconHome)
.child(S.editor().id('home').schemaType('home').documentId('home')),
S.listItem()
.title('Clients')
.icon(IconClients)
.child(
S.editor().id('clients').schemaType('clients').documentId('clients')
),
S.listItem()
.title('Information')
.icon(IconInformation)
.child(
S.editor()
.id('information')
.schemaType('information')
.documentId('information')
),
])
Apr 2, 2021, 7:52 AM
R
user D
Cool!! Clients == š¾ ftw!Apr 2, 2021, 4:34 PM
Sanityā build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.