diff --git a/public/data/battlesuits/dk.json b/public/data/battlesuits/dk.json index 8ed651ed..92d152a4 100644 --- a/public/data/battlesuits/dk.json +++ b/public/data/battlesuits/dk.json @@ -4,7 +4,7 @@ "name": "Drive Kometa", "type": "psychic", "valkyrie": "bronya", - "strengths": [], + "strengths": ["physical", "gather", "weaken", "burst", "time mastery"], "leader": { "core": { "name": "Mental Sync", diff --git a/public/data/battlesuits/ds.json b/public/data/battlesuits/ds.json index 8f7b73bb..ea4cbadb 100644 --- a/public/data/battlesuits/ds.json +++ b/public/data/battlesuits/ds.json @@ -4,7 +4,7 @@ "name": "Danzai Spectramancer", "type": "mecha", "valkyrie": "mei", - "strengths": [], + "strengths": ["physical"], "leader": { "core": { "name": "Phantom Outbreak", diff --git a/public/data/battlesuits/ft.json b/public/data/battlesuits/ft.json index 9712a6d3..b912d8e7 100644 --- a/public/data/battlesuits/ft.json +++ b/public/data/battlesuits/ft.json @@ -4,7 +4,7 @@ "name": "Fervent Tempo Δ", "type": "psychic", "valkyrie": "olenyevas", - "strengths": [], + "strengths": ["physical"], "leader": { "core": { "name": "SHOWTIME!", diff --git a/public/data/battlesuits/hf.json b/public/data/battlesuits/hf.json index 75520bfa..360920de 100644 --- a/public/data/battlesuits/hf.json +++ b/public/data/battlesuits/hf.json @@ -4,7 +4,7 @@ "name": "Hawk of the Fog", "type": "psychic", "valkyrie": "fuhua", - "strengths": [], + "strengths": ["lightning dmg", "heavy atk", "paralyze", "time mastery"], "leader": { "core": { "name": "Chelonic Unity", diff --git a/public/data/battlesuits/hfs.json b/public/data/battlesuits/hfs.json index b204ada2..88cee2f8 100644 --- a/public/data/battlesuits/hfs.json +++ b/public/data/battlesuits/hfs.json @@ -4,7 +4,7 @@ "name": "Herrscher of Flamescion", "type": "psychic", "valkyrie": "kiana", - "strengths": ["fire dmg", "heal", "time mastery", "gather"], + "strengths": ["fire dmg", "heal", "time mastery", "gather", "aerial"], "leader": { "core": { "name": "Nameless Knight-Errant's Path", diff --git a/public/data/battlesuits/hov.json b/public/data/battlesuits/hov.json index 20f42562..1c7537f9 100644 --- a/public/data/battlesuits/hov.json +++ b/public/data/battlesuits/hov.json @@ -4,7 +4,7 @@ "name": "Herrscher of the Void", "type": "biologic", "valkyrie": "kiana", - "strengths": ["physical", "time mastery", "fast atk"], + "strengths": ["physical", "time mastery", "fast atk", "aerial"], "leader": { "core": { "name": "Void Throne", diff --git a/public/data/battlesuits/io.json b/public/data/battlesuits/io.json index c2315785..17300d9e 100644 --- a/public/data/battlesuits/io.json +++ b/public/data/battlesuits/io.json @@ -4,7 +4,7 @@ "name": "Infinite Ouroboros", "type": "mecha", "valkyrie": "mobius", - "strengths": ["lightning dmg", "time mastery"], + "strengths": ["lightning dmg", "time mastery", "aerial"], "leader": { "core": { "name": "Infinite Fate", diff --git a/public/data/battlesuits/mpe.json b/public/data/battlesuits/mpe.json index 497d57eb..30ffa676 100644 --- a/public/data/battlesuits/mpe.json +++ b/public/data/battlesuits/mpe.json @@ -4,7 +4,7 @@ "name": "Miss Pink Elf♪", "type": "psychic", "valkyrie": "elysia", - "strengths": ["physical", "time mastery", "fast atk"], + "strengths": ["physical", "time mastery", "fast atk", "aerial"], "leader": { "core": { "name": "An Ode to Love and Compassion", diff --git a/public/data/battlesuits/pv.json b/public/data/battlesuits/pv.json index 99ed6000..2cd7f21d 100644 --- a/public/data/battlesuits/pv.json +++ b/public/data/battlesuits/pv.json @@ -4,7 +4,7 @@ "name": "Prinzessin der Verurteilung!", "type": "biologic", "valkyrie": "fischl", - "strengths": ["lightning dmg", "time mastery", "fast atk"], + "strengths": ["lightning dmg", "time mastery", "fast atk", "aerial"], "leader": { "core": { "name": "Evernight Suite", diff --git a/public/data/battlesuits/sns.json b/public/data/battlesuits/sns.json index 843a0e13..74034783 100644 --- a/public/data/battlesuits/sns.json +++ b/public/data/battlesuits/sns.json @@ -4,7 +4,7 @@ "name": "Sweet 'n' Spicy", "type": "mecha", "valkyrie": "carole", - "strengths": ["physical", "time mastery", "stun", "gather"], + "strengths": ["physical", "time mastery", "stun", "gather", "aerial"], "leader": { "core": { "name": "Star of Hope", diff --git a/public/data/battlesuits/stfu.json b/public/data/battlesuits/stfu.json index 649b2091..7b974136 100644 --- a/public/data/battlesuits/stfu.json +++ b/public/data/battlesuits/stfu.json @@ -4,7 +4,7 @@ "name": "Striker Fulminata", "type": "biologic", "valkyrie": "mei", - "strengths": [], + "strengths": ["physical", "burst", "fast atk", "paralyze"], "leader": { "core": { "name": "Sakura Aura", diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index b61e3d62..bb393da0 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -86,6 +86,27 @@ export const theme: Theme = { lineHeight: 'heading', }, }, + buttons: { + primary: { + color: 'primary', + borderColor: 'primary', + borderStyle: 'solid', + borderWidth: 1, + bg: 'background', + '&:hover, &.active': { + color: 'background', + bg: 'primary', + }, + }, + secondary: { + color: 'background', + bg: 'secondary', + }, + gray: { + color: 'background', + bg: 'gray', + }, + }, styles: { root: { fontFamily: 'body', diff --git a/src/pages/honkai3rd/battlesuits/index.tsx b/src/pages/honkai3rd/battlesuits/index.tsx index bfa43bfa..0be68648 100644 --- a/src/pages/honkai3rd/battlesuits/index.tsx +++ b/src/pages/honkai3rd/battlesuits/index.tsx @@ -1,8 +1,9 @@ -import { Box, Heading, Flex, Text, Link } from '@theme-ui/components' +import { Box, Heading, Flex, Text, Link, Button } from '@theme-ui/components' import Image from 'next/image' import NextLink from 'next/link' import { pick } from 'ramda' -import React from 'react' +import React, { useCallback, useMemo, useState } from 'react' +import SquareImageBox from '../../../components/atoms/SquareImageBox' import Breadcrumb from '../../../components/organisms/Breadcrumb' import Honkai3rdNavigator from '../../../components/organisms/Honkai3rdNavigator' import { @@ -10,11 +11,133 @@ import { listBattlesuits, } from '../../../data/honkai3rd/battlesuits' +type BattlesuitListItemData = Pick + interface BattlesuitListPageProps { - battlesuits: Pick[] + battlesuits: BattlesuitListItemData[] } +const featureFilterOptions = [ + { value: 'all', label: 'All' }, + { value: 'physical', label: 'Physical' }, + { value: 'fire dmg', label: 'Fire DMG' }, + { value: 'ice dmg', label: 'Ice DMG' }, + { value: 'lightning dmg', label: 'Lightning DMG' }, + { value: 'freeze', label: 'Freeze' }, + { value: 'paralyze', label: 'Paralyze' }, + { value: 'stun', label: 'Stun' }, + { value: 'ignite', label: 'Ignite' }, + { value: 'bleed', label: 'Bleed' }, + { value: 'heavy atk', label: 'Heavy ATK' }, + { value: 'weaken', label: 'Weaken' }, + { value: 'impair', label: 'Impair' }, + { value: 'time mastery', label: 'Time Mastery' }, + { value: 'gather', label: 'Gather' }, + { value: 'heal', label: 'Heal' }, + { value: 'fast atk', label: 'Fast ATK' }, + { value: 'burst', label: 'Burst' }, + { value: 'aerial', label: 'Aerial' }, +] + const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => { + const [filter, setFilter] = useState('all') + + const isBattlesuitHidden = useCallback( + (battlesuit: BattlesuitListItemData) => { + switch (filter) { + case 'physical': + case 'fire dmg': + case 'ice dmg': + case 'lightning dmg': + case 'freeze': + case 'paralyze': + case 'stun': + case 'ignite': + case 'bleed': + case 'heavy atk': + case 'weaken': + case 'impair': + case 'time mastery': + case 'gather': + case 'heal': + case 'fast atk': + case 'burst': + case 'aerial': + return !battlesuit.strengths.some((strength) => strength === filter) + default: + case 'all': + return false + } + }, + [filter] + ) + + const battlesuitList = useMemo(() => { + return battlesuits.map((battlesuit) => { + const hidden = isBattlesuitHidden(battlesuit) + return ( + + + + + {battlesuit.name} + + + {battlesuit.name} + + + + + ) + }) + }, [battlesuits, isBattlesuitHidden]) + return ( @@ -28,6 +151,60 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => { /> Battlesuits + + Filter by Features + + {featureFilterOptions.map(({ value, label }) => { + return ( + + ) + })} + + + Filter by Valkyries + + + + + + + + + + + + + + + + + + + + + + + + + + { justifyContent: 'space-around', }} > - {battlesuits.map((battlesuit) => { - return ( - - - - - {battlesuit.name} - - - {battlesuit.name} - - - - - ) - })} + {battlesuitList} @@ -104,8 +225,46 @@ export async function getStaticProps() { return { props: { battlesuits: listBattlesuits().map((battlesuit) => - pick(['id', 'name'], battlesuit) + pick(['id', 'name', 'strengths'], battlesuit) ), }, } } + +interface FilterButtonProps { + active?: boolean + icon?: string + label: string + setFilter: (filter: string) => void + value: string +} + +const FilterButton = ({ + active = false, + setFilter, + icon, + label, + value, +}: FilterButtonProps) => { + const selectFilter = useCallback(() => { + setFilter(value) + }, [setFilter, value]) + return ( + + ) +}