mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: filters
This commit is contained in:
1 parent
d851a05f53
commit
f1c31c6d79
6 files changed
+40
-9
No files matched your search
@@ -6,7 +6,6 @@ import { BlitzKitTheme } from './BlitzKitTheme';
|
||||
|
||||
type PageWrapperProps = FlexProps & {
|
||||
color?: ComponentProps<typeof Theme>['accentColor'];
|
||||
size?: number | string;
|
||||
noMaxWidth?: boolean;
|
||||
containerProps?: ComponentProps<typeof Theme>;
|
||||
noFlex1?: boolean;
|
||||
@@ -17,7 +16,6 @@ type PageWrapperProps = FlexProps & {
|
||||
export function PageWrapper({
|
||||
style,
|
||||
color,
|
||||
size = 800,
|
||||
children,
|
||||
noMaxWidth = false,
|
||||
noFlex1 = false,
|
||||
@@ -44,7 +42,6 @@ export function PageWrapper({
|
||||
p={padding}
|
||||
style={{
|
||||
width: '100%',
|
||||
maxWidth: noMaxWidth ? undefined : size,
|
||||
margin: 'auto',
|
||||
boxSizing: 'border-box',
|
||||
flex: 1,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ReloadIcon } from '@radix-ui/react-icons';
|
||||
import { Button, Flex } from '@radix-ui/themes';
|
||||
import { TierList } from '../../stores/tierList';
|
||||
import { tierListRows } from './Table/constants';
|
||||
|
||||
export function TierListControls() {
|
||||
const mutateTierList = TierList.useMutation();
|
||||
|
||||
return (
|
||||
<Flex justify="center">
|
||||
<Button
|
||||
color="red"
|
||||
onClick={() => {
|
||||
mutateTierList((draft) => {
|
||||
draft.tanks = tierListRows.map(() => []);
|
||||
});
|
||||
}}
|
||||
>
|
||||
<ReloadIcon /> Reset
|
||||
</Button>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { tierListRows } from './constants';
|
||||
|
||||
export function TierListTable() {
|
||||
return (
|
||||
<Table.Root variant="surface">
|
||||
<Table.Root variant="surface" mb="6">
|
||||
<Table.Body>
|
||||
{tierListRows.map((_, index) => (
|
||||
<TierListRow index={index} key={index} />
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { fetchTankDefinitions } from '@blitzkit/core';
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { filterTank } from '../../core/blitzkit/filterTank';
|
||||
import { $tankFilters } from '../../stores/tankFilters';
|
||||
import { TankCardWrapper } from '../TankSearch/components/TankCardWrapper';
|
||||
import { TierListTile } from './Tile';
|
||||
|
||||
@@ -6,11 +9,15 @@ const tankDefinitions = await fetchTankDefinitions();
|
||||
const tanks = Object.values(tankDefinitions.tanks);
|
||||
|
||||
export function TierListTiles() {
|
||||
const filters = useStore($tankFilters);
|
||||
|
||||
return (
|
||||
<TankCardWrapper>
|
||||
{tanks.map((tank) => (
|
||||
<TierListTile key={tank.id} tank={tank} />
|
||||
))}
|
||||
{tanks
|
||||
.filter((tank) => filterTank(filters, tank))
|
||||
.map((tank) => (
|
||||
<TierListTile key={tank.id} tank={tank} />
|
||||
))}
|
||||
</TankCardWrapper>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export function Page({ id, skeleton }: PageProps) {
|
||||
p="0"
|
||||
noMaxWidth
|
||||
color="purple"
|
||||
size={1600}
|
||||
maxWidth="100rem"
|
||||
gap="9"
|
||||
pb="9"
|
||||
>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { PageWrapper } from '../../../components/PageWrapper';
|
||||
import { FilterControl } from '../../../components/TankSearch/components/FilterControl';
|
||||
import { TierListControls } from '../../../components/TierList/Controls';
|
||||
import { TierListTable } from '../../../components/TierList/Table';
|
||||
import { TierListTiles } from '../../../components/TierList/Tiles';
|
||||
import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||
@@ -16,8 +18,10 @@ export function Page() {
|
||||
|
||||
function Content() {
|
||||
return (
|
||||
<PageWrapper color="orange">
|
||||
<PageWrapper color="orange" maxWidth="100rem">
|
||||
<TierListControls />
|
||||
<TierListTable />
|
||||
<FilterControl />
|
||||
<TierListTiles />
|
||||
</PageWrapper>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user