Skip to content

Commit

Permalink
Improve block centering behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
dabbott committed Mar 1, 2023
1 parent 8300b0a commit 2a9aad2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ exports[`hero left aligned default 1`] = `
className=\\"flex-col bg-transparent p-4 gap-3 items-start justify-center\\"
>
<Flex>
<Heading flex=\\"1\\" size=\\"xl\\" lineHeight=\\"1.3\\" className=\\"text-center\\">
<Heading flex=\\"1\\" size=\\"xl\\" lineHeight=\\"1.3\\" textAlign=\\"left\\">
{'Create, iterate, inspire.'}
</Heading>
</Flex>
<Text className=\\"text-center mb-4\\">
<Text className=\\"mb-4\\" textAlign=\\"left\\">
{'Turn great ideas into new possibilities.'}
</Text>
<Button size=\\"md\\" backgroundColor=\\"#15803d\\" color=\\"#fff\\" isDisabled={false}>
Expand Down
8 changes: 5 additions & 3 deletions packages/site/src/ayon/blocks/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { zip } from 'noya-utils';
import {
encodeBlockItem,
getTextAlign,
mergeBlockItems,
parseBlock,
ParsedBlockItemParameters,
Expand Down Expand Up @@ -106,6 +107,7 @@ export function getRenderableBlockProps({ props, block }: BlockRenderOptions) {
const container = getContainerBlockProps({ props, block });

const { parameters } = parseBlock(container.blockText, 'regular');
const hashtags = Object.keys(parameters);

const background = Object.keys(parameters)
.reverse()
Expand All @@ -115,13 +117,13 @@ export function getRenderableBlockProps({ props, block }: BlockRenderOptions) {
? /-(500|600|700|800|900)$/.test(background)
: undefined;

const textAlign = getTextAlign(hashtags);

const children = getChildrenBlockProps({
props,
block,
extraParameters: {
...(parameters.left && { left: true }),
...(parameters.right && { right: true }),
...(parameters.center && { center: true }),
...(textAlign && { [textAlign]: true }),
...((parameters.dark || darkBackground) && {
'text-white': true,
light: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/ayon/blocks/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ export const heroSymbolV2 = SketchModel.symbolMaster({
SketchModel.symbolInstance({
do_objectID: 'ef2d5b26-aa1c-40d3-8bab-37c10bccc5cb',
symbolID: heading2SymbolId,
blockText: 'Create, iterate, inspire. #text-center',
blockText: 'Create, iterate, inspire.',
}),
SketchModel.symbolInstance({
do_objectID: 'aa722c35-9ba4-4bf3-a5d0-f7d17f02c361',
symbolID: textSymbolId,
blockText: 'Turn great ideas into new possibilities. #text-center #mb-4',
blockText: 'Turn great ideas into new possibilities. #mb-4',
}),
SketchModel.symbolInstance({
do_objectID: '6b386c69-d6cf-4c2f-ae06-c92af43268d5',
Expand Down

0 comments on commit 2a9aad2

Please sign in to comment.