Skip to content

Commit

Permalink
fix: use typed theme object and optional chain access for selectable …
Browse files Browse the repository at this point in the history
…colors
  • Loading branch information
robinpyon committed Jan 15, 2024
1 parent 489e9f0 commit e5627c4
Showing 1 changed file with 63 additions and 61 deletions.
124 changes: 63 additions & 61 deletions src/components/MarkdownInputStyles.tsx
Original file line number Diff line number Diff line change
@@ -1,61 +1,63 @@
import styled from 'styled-components'
import {Box} from '@sanity/ui'

export const MarkdownInputStyles = styled(Box)`
& .CodeMirror.CodeMirror {
color: ${({theme}) => theme.sanity.color.card.enabled.fg};
border-color: ${({theme}) => theme.sanity.color.card.enabled.border};
background-color: inherit;
}
& .cm-s-easymde .CodeMirror-cursor {
border-color: ${({theme}) => theme.sanity.color.card.enabled.fg};
}
& .editor-toolbar,
.editor-preview-side {
border-color: ${({theme}) => theme.sanity.color.card.enabled.border};
}
& .CodeMirror-focused .CodeMirror-selected.CodeMirror-selected.CodeMirror-selected {
background-color: ${({theme}) => theme.sanity.color.selectable.primary.hovered.bg};
}
& .CodeMirror-selected.CodeMirror-selected.CodeMirror-selected {
background-color: ${({theme}) => theme.sanity.color.card.enabled.bg};
}
& .editor-toolbar > * {
color: ${({theme}) => theme.sanity.color.card.enabled.fg};
}
& .editor-toolbar > .active,
.editor-toolbar > button:hover,
.editor-preview pre,
.cm-s-easymde .cm-comment {
background-color: ${({theme}) => theme.sanity.color.card.enabled.bg};
}
& .editor-preview {
background-color: ${({theme}) => theme.sanity.color.card.enabled.bg};
& h1,
h2,
h3,
h4,
h5,
h6 {
font-size: revert;
}
& ul,
li {
list-style: revert;
padding: revert;
}
& a {
text-decoration: revert;
}
}
`
import {Box, type Theme} from '@sanity/ui'
import styled, {css} from 'styled-components'

export const MarkdownInputStyles = styled(Box)(({theme}: {theme: Theme}) => {
return css`
& .CodeMirror.CodeMirror {
color: ${theme.sanity.color.card.enabled.fg};
border-color: ${theme.sanity.color.card.enabled.border};
background-color: inherit;
}
& .cm-s-easymde .CodeMirror-cursor {
border-color: ${theme.sanity.color.card.enabled.fg};
}
& .editor-toolbar,
.editor-preview-side {
border-color: ${theme.sanity.color.card.enabled.border};
}
& .CodeMirror-focused .CodeMirror-selected.CodeMirror-selected.CodeMirror-selected {
background-color: ${theme.sanity.color.selectable?.primary?.hovered?.bg};
}
& .CodeMirror-selected.CodeMirror-selected.CodeMirror-selected {
background-color: ${theme.sanity.color.card.enabled.bg};
}
& .editor-toolbar > * {
color: ${theme.sanity.color.card.enabled.fg};
}
& .editor-toolbar > .active,
.editor-toolbar > button:hover,
.editor-preview pre,
.cm-s-easymde .cm-comment {
background-color: ${theme.sanity.color.card.enabled.bg};
}
& .editor-preview {
background-color: ${theme.sanity.color.card.enabled.bg};
& h1,
h2,
h3,
h4,
h5,
h6 {
font-size: revert;
}
& ul,
li {
list-style: revert;
padding: revert;
}
& a {
text-decoration: revert;
}
}
`
})

0 comments on commit e5627c4

Please sign in to comment.