From 3b74580b4f60663e032c1873b90a75d7822e96fd Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Thu, 3 Jun 2021 13:20:34 +0100 Subject: [PATCH] Fixes styling on page select, bumps data version --- components/page-panel/page-panel.tsx | 2 ++ components/shared.tsx | 4 ++-- components/style-panel/style-panel.tsx | 2 +- state/data.ts | 12 ++++++------ state/history.ts | 7 ++++--- state/state.ts | 8 ++++---- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/components/page-panel/page-panel.tsx b/components/page-panel/page-panel.tsx index f0ee2f11d..bd5bcf6f4 100644 --- a/components/page-panel/page-panel.tsx +++ b/components/page-panel/page-panel.tsx @@ -80,6 +80,8 @@ const StyledRadioItem = styled(DropdownMenu.RadioItem, { padding: '0 6px 0 12px', cursor: 'pointer', borderRadius: '4px', + fontSize: '$1', + fontFamily: '$ui', backgroundColor: 'transparent', outline: 'none', '&:hover': { diff --git a/components/shared.tsx b/components/shared.tsx index 3810f1c68..de05dfc45 100644 --- a/components/shared.tsx +++ b/components/shared.tsx @@ -74,6 +74,8 @@ export const RowButton = styled('button', { cursor: 'pointer', outline: 'none', alignItems: 'center', + fontFamily: '$ui', + fontSize: '$1', justifyContent: 'space-between', padding: '4px 6px 4px 12px', @@ -94,8 +96,6 @@ export const RowButton = styled('button', { }, '& label': { - fontFamily: '$ui', - fontSize: '$2', fontWeight: '$1', margin: 0, padding: 0, diff --git a/components/style-panel/style-panel.tsx b/components/style-panel/style-panel.tsx index 1358b58fa..c55c2912d 100644 --- a/components/style-panel/style-panel.tsx +++ b/components/style-panel/style-panel.tsx @@ -266,7 +266,7 @@ const Row = styled('div', { '& label': { fontFamily: '$ui', - fontSize: '$2', + fontSize: '$1', fontWeight: '$1', margin: 0, padding: 0, diff --git a/state/data.ts b/state/data.ts index 9b37c1d15..d4ad873a0 100644 --- a/state/data.ts +++ b/state/data.ts @@ -3,10 +3,10 @@ import shapeUtils from 'lib/shape-utils' export const defaultDocument: Data['document'] = { pages: { - page0: { - id: 'page0', + page1: { + id: 'page1', type: 'page', - name: 'Page 0', + name: 'Page 1', childIndex: 0, shapes: { // arrowShape0: shapeUtils[ShapeType.Arrow].create({ @@ -128,10 +128,10 @@ export const defaultDocument: Data['document'] = { // }), }, }, - page1: { - id: 'page1', + page2: { + id: 'page2', type: 'page', - name: 'Page 1', + name: 'Page 2', childIndex: 1, shapes: {}, }, diff --git a/state/history.ts b/state/history.ts index 4465258d4..5214432d0 100644 --- a/state/history.ts +++ b/state/history.ts @@ -1,6 +1,7 @@ import { Data } from 'types' import { BaseCommand } from './commands/command' -import state from './state' + +const CURRENT_VERSION = 'code_slate_0.0.2' // A singleton to manage history changes. @@ -44,7 +45,7 @@ class BaseHistory { this.save(data) } - load(data: T, id = 'code_slate_0.0.1') { + load(data: T, id = CURRENT_VERSION) { if (typeof window === 'undefined') return if (typeof localStorage === 'undefined') return @@ -55,7 +56,7 @@ class BaseHistory { } } - save = (data: T, id = 'code_slate_0.0.1') => { + save = (data: T, id = CURRENT_VERSION) => { if (typeof window === 'undefined') return if (typeof localStorage === 'undefined') return diff --git a/state/state.ts b/state/state.ts index 4bb0c221b..4efe91792 100644 --- a/state/state.ts +++ b/state/state.ts @@ -61,18 +61,18 @@ const initialData: Data = { pointedId: null, hoveredId: null, selectedIds: new Set([]), - currentPageId: 'page0', + currentPageId: 'page1', currentCodeFileId: 'file0', codeControls: {}, document: defaultDocument, pageStates: { - page0: { + page1: { camera: { point: [0, 0], zoom: 1, }, }, - page1: { + page2: { camera: { point: [0, 0], zoom: 1, @@ -1325,7 +1325,7 @@ const state = createState({ }, restoreSavedData(data) { - // history.load(data) + history.load(data) }, clearBoundsRotation(data) {