From 198ad177b7d9ac295aabd1ce9b32f6528248e51f Mon Sep 17 00:00:00 2001 From: Neko-Life Date: Sat, 15 Jul 2023 09:56:31 +0700 Subject: [PATCH 1/2] make back button reusable component and add default transition duration config --- client/src/lib/backButton.svelte | 22 ++++++++++++++++++++++ client/src/lib/config.ts | 1 + client/src/lib/game.svelte | 12 ++++-------- 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 client/src/lib/backButton.svelte create mode 100644 client/src/lib/config.ts diff --git a/client/src/lib/backButton.svelte b/client/src/lib/backButton.svelte new file mode 100644 index 0000000..710ba64 --- /dev/null +++ b/client/src/lib/backButton.svelte @@ -0,0 +1,22 @@ + + + + + + + + + \ No newline at end of file diff --git a/client/src/lib/config.ts b/client/src/lib/config.ts new file mode 100644 index 0000000..e76ff66 --- /dev/null +++ b/client/src/lib/config.ts @@ -0,0 +1 @@ +export const DEFAULT_TRANSITION_DURATION = 400; \ No newline at end of file diff --git a/client/src/lib/game.svelte b/client/src/lib/game.svelte index b84ac88..2590e67 100644 --- a/client/src/lib/game.svelte +++ b/client/src/lib/game.svelte @@ -3,6 +3,8 @@ import { quadOut } from "svelte/easing"; import { draw, fade, fly } from "svelte/transition"; import Move from "./move.svelte"; + import { DEFAULT_TRANSITION_DURATION } from "./config"; + import BackButton from "./backButton.svelte"; export var self: 1 | 2 = 1; export var twoPlayer: boolean = false; @@ -172,7 +174,7 @@ var movesShown = false; - const duration = 400; + const duration = DEFAULT_TRANSITION_DURATION; var moveDelayMultiplier = 1; onMount(() => { @@ -189,13 +191,7 @@ hoveredPiece = null} /> - - - - - - - + {#if !twoPlayer} From 9e7092a0f64e84ef4b1181e7e2308ec65fe527f3 Mon Sep 17 00:00:00 2001 From: Neko-Life Date: Sat, 15 Jul 2023 16:05:46 +0700 Subject: [PATCH 2/2] formatting --- client/.prettierrc | 11 ++++++----- client/src/lib/backButton.svelte | 28 ++++++++++++++-------------- client/src/lib/game.svelte | 4 ++-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/client/.prettierrc b/client/.prettierrc index ff2677e..ab96ecc 100644 --- a/client/.prettierrc +++ b/client/.prettierrc @@ -1,6 +1,7 @@ { - "useTabs": true, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100 -} + "useTabs": false, + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100 +} \ No newline at end of file diff --git a/client/src/lib/backButton.svelte b/client/src/lib/backButton.svelte index 710ba64..0c77f27 100644 --- a/client/src/lib/backButton.svelte +++ b/client/src/lib/backButton.svelte @@ -1,22 +1,22 @@ - - - - - + + + + + \ No newline at end of file diff --git a/client/src/lib/game.svelte b/client/src/lib/game.svelte index 2590e67..bbe1e5f 100644 --- a/client/src/lib/game.svelte +++ b/client/src/lib/game.svelte @@ -3,8 +3,8 @@ import { quadOut } from "svelte/easing"; import { draw, fade, fly } from "svelte/transition"; import Move from "./move.svelte"; - import { DEFAULT_TRANSITION_DURATION } from "./config"; - import BackButton from "./backButton.svelte"; + import { DEFAULT_TRANSITION_DURATION } from "./config"; + import BackButton from "./backButton.svelte"; export var self: 1 | 2 = 1; export var twoPlayer: boolean = false;