-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🎨 better text wrapping * 🎨 add background image to grid and more content alignment options * 🎨 update grid * 🐛 fix alignment on span2 * 🎨 update grid components * 🐛 fix heading for sharedtitle * 🎨 fix some alignment issues * 🎨 fix some issues * 🎨 dont use theme when themed title * 🎨 same for gridteaser * 🎨 add more bg to arrow variant * 🎨 better image validation on image teaser
- Loading branch information
1 parent
cda5fc0
commit 79c96b5
Showing
29 changed files
with
959 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './blockContentType' | ||
export * from './titleEditorContentType' | ||
export * from './themedTitleEditorContentType' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { SuperScriptRenderer, SubScriptRenderer, StrikeThroughRenderer } from '../components' | ||
import { IconSuperScript, IconSubScript } from '../../icons' | ||
import { StrikethroughIcon } from '@sanity/icons' | ||
import { BlockDefinition } from 'sanity' | ||
import { em, ExtraLargeTextRender, LargeTextRender } from './blockContentType' | ||
|
||
export type ThemedTitleContentProps = { | ||
normalText?: boolean | ||
largeText?: boolean | ||
extraLargeText?: boolean | ||
twoXLText?: boolean | ||
} | ||
|
||
const TwoXLTextRender = (props: any) => { | ||
const { children } = props | ||
return <span style={{ fontSize: `${em(64, 16)}`, fontWeight: '400' }}>{children}</span> | ||
} | ||
|
||
// TODO: Add relevant styles for titles (i.e. highlighted text) | ||
export const configureThemedTitleBlockContent = (options: ThemedTitleContentProps = {}): BlockDefinition => { | ||
const { largeText = true, extraLargeText = false, twoXLText = false, normalText = true } = options | ||
|
||
const config: BlockDefinition = { | ||
type: 'block', | ||
name: 'block', | ||
styles: [], | ||
lists: [], | ||
marks: { | ||
decorators: [ | ||
{ title: 'Strong', value: 'strong' }, | ||
{ title: 'Emphasis', value: 'em' }, | ||
{ | ||
title: 'Strikethrough', | ||
value: 's', | ||
icon: StrikethroughIcon, | ||
component: StrikeThroughRenderer, | ||
}, | ||
{ | ||
title: 'Sub', | ||
value: 'sub', | ||
icon: IconSubScript, | ||
component: SubScriptRenderer, | ||
}, | ||
{ | ||
title: 'Super', | ||
value: 'sup', | ||
icon: IconSuperScript, | ||
component: SuperScriptRenderer, | ||
}, | ||
], | ||
annotations: [], | ||
}, | ||
} | ||
|
||
const normalTextConfig = { title: 'Normal', value: 'normal' } | ||
// Since one cant disable value normal, when title should only have large and not normal, make normal like Large | ||
// Make sure that the block serializer picks up this 'as large' for normal text | ||
const normalAsLargeTextConfig = { title: 'Large', value: 'normal', blockEditor: { render: LargeTextRender } } | ||
|
||
const largeTextConfig = { | ||
title: 'Large text', | ||
value: 'largeText', | ||
component: LargeTextRender, | ||
} | ||
const extraLargeTextConfig = { | ||
title: 'Extra large text', | ||
value: 'extraLargeText', | ||
component: ExtraLargeTextRender, | ||
} | ||
const twoXLTextConfig = { | ||
title: '2XL text', | ||
value: 'twoXLText', | ||
component: TwoXLTextRender, | ||
} | ||
|
||
if (normalText) { | ||
config?.styles?.push(normalTextConfig) | ||
} | ||
if (!normalText && largeText) { | ||
config?.styles?.push(normalAsLargeTextConfig) | ||
} | ||
if (normalText && largeText) { | ||
config?.styles?.push(largeTextConfig) | ||
} | ||
if (extraLargeText) { | ||
config?.styles?.push(extraLargeTextConfig) | ||
} | ||
if (twoXLText) { | ||
config?.styles?.push(twoXLTextConfig) | ||
} | ||
|
||
return config | ||
} | ||
|
||
export default configureThemedTitleBlockContent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.