Skip to content

Commit

Permalink
[add] deselect all button on CharacterSelectionDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
spd789562 committed Nov 12, 2024
1 parent 562ce4a commit e97bff0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const CharacterSelectionDialog = (
return (
<Dialog.Root {...props}>
<Portal>
<Dialog.Backdrop zIndex="settingOverlay" />
<Dialog.Positioner zIndex="settingModal">
<Dialog.Content minWidth="2xl">
<Dialog.Backdrop zIndex="topDrawer" />
<Dialog.Positioner zIndex="topDrawer">
<Dialog.Content minWidth="2xl" height="75%">
{props.children}
<Dialog.CloseTrigger
asChild={(closeTriggerProps) => (
Expand Down
16 changes: 13 additions & 3 deletions src/components/dialog/CharacterSelectionDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createSignal, splitProps, createEffect, on } from 'solid-js';
import { createSignal, splitProps } from 'solid-js';
import type { ReadableAtom } from 'nanostores';

import { Grid } from 'styled-system/jsx/grid';
import { HStack } from 'styled-system/jsx';
import {
Title,
type RootProps as DialogRootProps,
type OpenChangeDetails,
} from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';

import { CharacterSelectionDialog as Dialog } from './CharacterSelectionDialog';
import { CharacterGrid } from './CharacterGrid';
Expand Down Expand Up @@ -46,6 +48,10 @@ export const CharacterSelectionDialog = (
setSelectIds([...currentIds]);
}

function handleClear() {
setSelectIds([]);
}

function handleExit() {
props.onExit?.(selectedIds());
}
Expand All @@ -58,8 +64,7 @@ export const CharacterSelectionDialog = (
>
<Grid
position="relative"
overflow="auto"
gridTemplateRows="auto 1fr"
gridTemplateRows="auto 1fr auto"
height="[100%]"
padding="4"
>
Expand All @@ -69,6 +74,11 @@ export const CharacterSelectionDialog = (
selectedIds={selectedIds()}
onSelect={handleSelect}
/>
<HStack justify="flex-end" py="1">
<Button variant="outline" onClick={handleClear}>
清除選取
</Button>
</HStack>
</Grid>
</Dialog>
);
Expand Down

0 comments on commit e97bff0

Please sign in to comment.