feat(NewCharButton): Update NewCharButton

* Refactor NewCharButton
  * Remove BarIcon at NewCharButton
  * Replaced BaseRoundedButton and SVG
This commit is contained in:
phyyou
2023-05-13 02:50:37 +09:00
parent 8e6ac84c3b
commit ff93c72dcc
2 changed files with 43 additions and 12 deletions

View File

@@ -36,6 +36,7 @@
import { onDestroy } from "svelte";
import { isEqual } from "lodash";
import SidebarAvatar from "./SidebarAvatar.svelte";
import BaseRoundedButton from "../UI/BaseRoundedButton.svelte";
let openPresetList = false;
let sideBarMode = 0;
let editMode = false;
@@ -101,7 +102,9 @@
{#if menuMode === 0}
{#each charImages as charimg, i}
<div class="group relative flex items-center px-2">
<SidebarIndicator isActive={$selectedCharID === i} />
<SidebarIndicator
isActive={$selectedCharID === i && sideBarMode !== 1}
/>
{#if charimg !== ""}
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<div
@@ -169,17 +172,29 @@
{/if}
</div>
{/each}
<BarIcon
onClick={() => {
if (sideBarMode === 1) {
reseter();
sideBarMode = 0;
} else {
reseter();
sideBarMode = 1;
}
}}><PlusIcon /></BarIcon
>
<div class="flex flex-col items-center space-y-2 px-2">
<BaseRoundedButton
onClick={() => {
if (sideBarMode === 1) {
reseter();
sideBarMode = 0;
} else {
reseter();
sideBarMode = 1;
}
}}
><svg viewBox="0 0 24 24" width="1.2em" height="1.2em"
><path
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 6v6m0 0v6m0-6h6m-6 0H6"
/></svg
></BaseRoundedButton
>
</div>
{:else}
<BarIcon
onClick={() => {

View File

@@ -0,0 +1,16 @@
<script lang="ts">
export let isDisabled: boolean = false;
export let onClick: () => void;
</script>
<button
disabled={isDisabled}
on:click={onClick}
class="flex h-[56px] w-[56px] cursor-pointer select-none items-center justify-center
transition-colors rounded-full
border border-gray-500 text-gray-300
hover:border-gray-300
{isDisabled ? '!cursor-not-allowed' : ''}"
>
<slot />
</button>