Sort stigmata set

This commit is contained in:
Sakura Knoll
2023-07-12 00:26:17 +09:00 Unverified
parent 688cdee398
commit 7a59ff0196
+22 -3
View File
@@ -3,8 +3,8 @@ import { Box, Card } from '@theme-ui/components'
import { NextPageContext } from 'next' import { NextPageContext } from 'next'
import { Flex, Link } from 'theme-ui' import { Flex, Link } from 'theme-ui'
import { StigmataCatalogItem, StigmataSetCatalogItem } from '../../../lib/v2-pre/data/types' import { StigmataSetCatalogItem } from '../../../lib/v2-pre/data/types'
import { loadStigmataCatalog, loadStigmataSetCatalog } from '../../../lib/v2-pre/server/loadData' import { loadStigmataSetCatalog } from '../../../lib/v2-pre/server/loadData'
import StigmaIcon from '../../../components/v2-pre/StigmaIcon' import StigmaIcon from '../../../components/v2-pre/StigmaIcon'
interface StigmataSetListPageProps { interface StigmataSetListPageProps {
@@ -16,7 +16,26 @@ const StigmataSetListPage = ({ stigmataSetCatalog }: StigmataSetListPageProps) =
<Box> <Box>
<h1>Stigmata (Set)</h1> <h1>Stigmata (Set)</h1>
<Flex sx={{ flexWrap: 'wrap' }}> <Flex sx={{ flexWrap: 'wrap' }}>
{stigmataSetCatalog.map(stigmataSet => { {stigmataSetCatalog
.sort((a, b) => {
const aId = getId(a.id)
const bId = getId(b.id)
return bId - aId
function getId(id: string): number {
if (id === '1290') {
return 129.5
}
if (id === '132') {
return 0.2
}
if (id === '120') {
return 0.1
}
return parseInt(id)
}
})
.map(stigmataSet => {
return ( return (
<Box key={stigmataSet.id} m={2}> <Box key={stigmataSet.id} m={2}>
<Link href={`/v2-pre/stigmata-sets/${stigmataSet.id}`}> <Link href={`/v2-pre/stigmata-sets/${stigmataSet.id}`}>