Skip to content

Commit

Permalink
Remove unused layer override
Browse files Browse the repository at this point in the history
  • Loading branch information
dabbott committed Mar 5, 2023
1 parent 9427b41 commit 9d5c9c2
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 24 deletions.
16 changes: 1 addition & 15 deletions packages/noya-file-format/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1181,21 +1181,7 @@ export type OverrideValue = {
_class: 'overrideValue';
do_objectID?: Uuid;
overrideName: OverrideName;
value:
| boolean
| string
| Uuid
| FileRef
| DataRef
| ResolvedBlockData
| LayersOverrideValue;
};

export type LayersOverrideValue = {
layers: Pick<
SymbolInstance,
'do_objectID' | 'symbolID' | 'blockText' | 'resolvedBlockData'
>[];
value: boolean | string | Uuid | FileRef | DataRef | ResolvedBlockData;
};

/**
Expand Down
3 changes: 0 additions & 3 deletions packages/noya-state/src/overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export type PropertyTypeMap = {
blockText: string;
resolvedBlockData: Sketch.ResolvedBlockData;
isVisible: boolean;
layers: Sketch.LayersOverrideValue;
};

export type PropertyType = keyof PropertyTypeMap;
Expand Down Expand Up @@ -66,8 +65,6 @@ export function getLayerOverride(
value: PropertyValue,
) {
switch (propertyType) {
case 'layers':
return { type: propertyType, value, layer } as const;
case 'isVisible': {
if (!isValidProperty(propertyType, value)) return;

Expand Down
67 changes: 67 additions & 0 deletions packages/site/src/__tests__/__snapshots__/renderBlock.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,36 @@ exports[`hero default 1`] = `
"
`;
exports[`hero left aligned 1`] = `
"<Frame width={400} height={400}>
<Flex
width=\\"400px\\"
height=\\"400px\\"
className=\\"flex-col bg-transparent p-4 gap-3 items-start justify-center\\"
>
<Flex>
<Heading flex=\\"1\\" size=\\"xl\\" lineHeight=\\"1.3\\" textAlign=\\"left\\">
{'Create, iterate, inspire.'}
</Heading>
</Flex>
<Text className=\\"mb-4\\" textAlign=\\"left\\">
{'Turn great ideas into new possibilities.'}
</Text>
<Flex className=\\"bg-transparent flex-row items-center gap-6\\">
<Button
size=\\"md\\"
backgroundColor=\\"#15803d\\"
color=\\"#fff\\"
isDisabled={false}
>
{'Get started'}
</Button>
</Flex>
</Flex>
</Frame>;
"
`;
exports[`hero left aligned default 1`] = `
"<Frame width={400} height={400}>
<Flex
Expand Down Expand Up @@ -130,6 +160,43 @@ exports[`hero left aligned default 1`] = `
"
`;
exports[`hero with bg 1`] = `
"<Frame width={400} height={400}>
<Flex
width=\\"400px\\"
height=\\"400px\\"
className=\\"flex-col bg-blue-500 p-4 gap-3 items-center justify-center\\"
>
<Flex>
<Heading
flex=\\"1\\"
size=\\"xl\\"
lineHeight=\\"1.3\\"
className=\\"text-white\\"
textAlign=\\"center\\"
>
{'Create, iterate, inspire.'}
</Heading>
</Flex>
<Text className=\\"mb-4 text-white\\" textAlign=\\"center\\">
{'Turn great ideas into new possibilities.'}
</Text>
<Flex className=\\"bg-transparent flex-row items-center gap-6\\">
<Button
size=\\"md\\"
backgroundColor=\\"#f1f5f9\\"
color=\\"#000\\"
isDisabled={false}
className=\\"text-white\\"
>
{'Get started'}
</Button>
</Flex>
</Flex>
</Frame>;
"
`;
exports[`hero with bg default 1`] = `
"<Frame width={400} height={400}>
<Flex
Expand Down
8 changes: 2 additions & 6 deletions packages/site/src/__tests__/renderBlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ describe('hero', () => {

expect(generate(symbol)).toMatchSnapshot();
});
});

describe('hero left aligned', () => {
test('default', () => {
test('left aligned', () => {
const symbol = SketchModel.symbolInstance({
symbolID: heroSymbolV2Id,
frame: SketchModel.rect({
Expand All @@ -140,10 +138,8 @@ describe('hero left aligned', () => {

expect(generate(symbol)).toMatchSnapshot();
});
});

describe('hero with bg', () => {
test('default', () => {
test('with bg', () => {
const symbol = SketchModel.symbolInstance({
symbolID: heroSymbolV2Id,
frame: SketchModel.rect({
Expand Down

0 comments on commit 9d5c9c2

Please sign in to comment.