add job grid cell components
- JobIconCell: job portrait thumbnail - JobTierCell: row tier badge - JobProficienciesCell: weapon proficiency icons - JobFeaturesCell: master/ultimate/accessory badges
This commit is contained in:
parent
ec4b4bc3ae
commit
88fcc039db
4 changed files with 143 additions and 0 deletions
55
src/lib/components/database/cells/JobFeaturesCell.svelte
Normal file
55
src/lib/components/database/cells/JobFeaturesCell.svelte
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<svelte:options runes={true} />
|
||||
|
||||
<script lang="ts">
|
||||
import type { Cell } from 'wx-svelte-grid'
|
||||
|
||||
const { row }: Cell = $props()
|
||||
</script>
|
||||
|
||||
<div class="features-cell">
|
||||
{#if row.masterLevel}
|
||||
<span class="badge master">Master</span>
|
||||
{/if}
|
||||
{#if row.ultimateMastery}
|
||||
<span class="badge ultimate">Ultimate</span>
|
||||
{/if}
|
||||
{#if row.accessory}
|
||||
<span class="badge accessory">Accessory</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
@use '$src/themes/colors' as colors;
|
||||
@use '$src/themes/typography' as typography;
|
||||
|
||||
.features-cell {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: typography.$font-tiny;
|
||||
font-weight: typography.$medium;
|
||||
|
||||
&.master {
|
||||
background: colors.$yellow;
|
||||
color: white;
|
||||
}
|
||||
|
||||
&.ultimate {
|
||||
background: colors.$dark-bg-00;
|
||||
color: white;
|
||||
}
|
||||
|
||||
&.accessory {
|
||||
background: colors.$blue;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
29
src/lib/components/database/cells/JobIconCell.svelte
Normal file
29
src/lib/components/database/cells/JobIconCell.svelte
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<svelte:options runes={true} />
|
||||
|
||||
<script lang="ts">
|
||||
import type { Cell } from 'wx-svelte-grid'
|
||||
import { getJobIconUrl } from '$lib/utils/jobUtils'
|
||||
|
||||
const { row }: Cell = $props()
|
||||
</script>
|
||||
|
||||
<div class="image-cell">
|
||||
<img src={getJobIconUrl(row.granblueId)} alt={row.name?.en || ''} class="job-icon" />
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.image-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.job-icon {
|
||||
width: auto;
|
||||
height: 32px;
|
||||
object-fit: contain;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<svelte:options runes={true} />
|
||||
|
||||
<script lang="ts">
|
||||
import type { Cell } from 'wx-svelte-grid'
|
||||
import ProficiencyLabel from '$lib/components/labels/ProficiencyLabel.svelte'
|
||||
|
||||
const { row }: Cell = $props()
|
||||
</script>
|
||||
|
||||
<div class="proficiencies-cell">
|
||||
{#if row.proficiency?.[0]}
|
||||
<ProficiencyLabel proficiency={row.proficiency[0]} size="small" />
|
||||
{/if}
|
||||
{#if row.proficiency?.[1]}
|
||||
<ProficiencyLabel proficiency={row.proficiency[1]} size="small" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.proficiencies-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
33
src/lib/components/database/cells/JobTierCell.svelte
Normal file
33
src/lib/components/database/cells/JobTierCell.svelte
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<svelte:options runes={true} />
|
||||
|
||||
<script lang="ts">
|
||||
import type { Cell } from 'wx-svelte-grid'
|
||||
import { getJobTierName } from '$lib/utils/jobUtils'
|
||||
|
||||
const { row }: Cell = $props()
|
||||
const tierName = $derived(getJobTierName(row.row))
|
||||
</script>
|
||||
|
||||
<div class="tier-cell">
|
||||
<span class="tier-badge">{tierName}</span>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
@use '$src/themes/colors' as colors;
|
||||
@use '$src/themes/typography' as typography;
|
||||
|
||||
.tier-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tier-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
background: colors.$grey-90;
|
||||
border-radius: 4px;
|
||||
font-size: typography.$font-small;
|
||||
color: colors.$grey-30;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in a new issue