Separate serve lib

This commit is contained in:
Sakura Knoll
2022-01-01 21:13:44 +09:00 Unverified
parent 0b406525fa
commit d7d94f2ba2
28 changed files with 265 additions and 309 deletions
@@ -1,5 +1,5 @@
import { Flex, Text } from '@theme-ui/components'
import { battlesuitStrengths } from '../../lib/safeData'
import { battlesuitStrengths } from '../../lib/honkai3rd/battlesuits'
import SquareImageBox from './SquareImageBox'
interface BattlesuitFeatureLabelProps {
+6 -44
View File
@@ -1,4 +1,5 @@
import { Flex, Text } from '@theme-ui/components'
import { valkyries } from '../../lib/honkai3rd/battlesuits'
import SquareImageBox from './SquareImageBox'
interface ValkyrieLabelProps {
@@ -6,13 +7,16 @@ interface ValkyrieLabelProps {
}
const ValkyrieLabel = ({ valkyrie }: ValkyrieLabelProps) => {
const { icon, label } = getLabelData(valkyrie)
const { icon, label } = valkyries.find(
(aValkyrie) => aValkyrie.value === valkyrie
) || { label: valkyrie }
return (
<Flex sx={{ alignItems: 'center' }}>
{icon && (
<SquareImageBox
size={30}
src={`/assets/honkai3rd/valkyrie-icons/${icon}.png`}
src={`/assets/honkai3rd/${icon}.png`}
alt={label}
mr={1}
/>
@@ -23,45 +27,3 @@ const ValkyrieLabel = ({ valkyrie }: ValkyrieLabelProps) => {
}
export default ValkyrieLabel
function getLabelData(valkyrie: string): { label: string; icon?: string } {
switch (valkyrie) {
case 'kiana':
return { icon: 'kiana', label: 'Kiana Kaslana' }
case 'mei':
return { icon: 'mei', label: 'Raiden Mei' }
case 'bronya':
return { icon: 'bronya', label: 'Bronya Zaychik' }
case 'himeko':
return { icon: 'himeko', label: 'Murata Himeko' }
case 'theresa':
return { icon: 'theresa', label: 'Theresa Apocalypse' }
case 'fuhua':
return { icon: 'fuhua', label: 'Fu Hua' }
case 'rita':
return { icon: 'rita', label: 'Rita Rossweisse' }
case 'sakura':
return { icon: 'sakura', label: 'Yae Sakura' }
case 'kallen':
return { icon: 'kallen', label: 'Kallen Kaslana' }
case 'olenyevas':
return { icon: 'olenyevas', label: 'Olenyevas' }
case 'seele':
return { icon: 'seele', label: 'Seele Vollerei' }
case 'durandal':
return { icon: 'durandal', label: 'Durandal' }
case 'fischl':
return { icon: 'fischl', label: 'Fischl' }
case 'elysia':
return { icon: 'elysia', label: 'Elysia' }
case 'mobius':
return { icon: 'mobius', label: 'Mobius' }
case 'raven':
return { icon: 'raven', label: 'Raven' }
case 'carole':
return { icon: 'carole', label: 'Carole Pepper' }
}
return {
label: valkyrie,
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { Box, Card, Text } from '@theme-ui/components'
import { BattlesuitData } from '../../server/data/honkai3rd/battlesuits'
import { BattlesuitData } from '../../lib/honkai3rd/battlesuits'
import PageLink from '../atoms/PageLink'
import SquareImageBox from '../atoms/SquareImageBox'