124 lines
2.8 KiB
Vue
124 lines
2.8 KiB
Vue
<template>
|
|
<div class="boursecu-bank-option" :class="{ 'boursecu-bank-option--compact': compact }">
|
|
<div
|
|
class="boursecu-bank-option__logo"
|
|
:class="{ 'boursecu-bank-option__logo--image': !!logoUrl }"
|
|
:style="logoUrl ? undefined : { backgroundColor: accentColor }"
|
|
>
|
|
<img v-if="logoUrl" :src="logoUrl" :alt="displayName" />
|
|
<span v-else>{{ monogram }}</span>
|
|
</div>
|
|
<div class="boursecu-bank-option__content">
|
|
<div class="boursecu-bank-option__title">{{ displayName }}</div>
|
|
<div class="boursecu-bank-option__sheba">{{ shebaText }}</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import type { Card } from '@/models/wallet'
|
|
import {
|
|
formatShebaForDisplay,
|
|
getBankAccentColor,
|
|
getBankDisplayName,
|
|
getBankLogoUrl,
|
|
getBankMonogram,
|
|
resolveBankKey,
|
|
} from '@/utils/bankBranding'
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
card: Card
|
|
compact?: boolean
|
|
}>(),
|
|
{ compact: false },
|
|
)
|
|
|
|
const bankKey = computed(() => resolveBankKey(props.card))
|
|
const accentColor = computed(() => getBankAccentColor(bankKey.value))
|
|
const displayName = computed(() => getBankDisplayName(bankKey.value))
|
|
const logoUrl = computed(() => getBankLogoUrl(bankKey.value))
|
|
const monogram = computed(() => getBankMonogram(bankKey.value))
|
|
const shebaText = computed(() => formatShebaForDisplay(props.card.shaba_number))
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.boursecu-bank-option {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
width: 100%;
|
|
min-width: 0;
|
|
}
|
|
|
|
.boursecu-bank-option__logo {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
width: 42px;
|
|
height: 42px;
|
|
border-radius: 12px;
|
|
color: #fff;
|
|
font-size: 0.72rem;
|
|
font-weight: 800;
|
|
line-height: 1.1;
|
|
text-align: center;
|
|
padding: 4px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.boursecu-bank-option__logo--image {
|
|
background: #fff;
|
|
border: 1px solid #e5e7eb;
|
|
padding: 6px;
|
|
}
|
|
|
|
.boursecu-bank-option__logo img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.boursecu-bank-option--compact .boursecu-bank-option__logo {
|
|
width: 38px;
|
|
height: 38px;
|
|
}
|
|
|
|
.boursecu-bank-option__content {
|
|
min-width: 0;
|
|
flex: 1;
|
|
text-align: right;
|
|
}
|
|
|
|
.boursecu-bank-option__title {
|
|
font-size: 0.95rem;
|
|
font-weight: 700;
|
|
color: #111827;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
.boursecu-bank-option--compact .boursecu-bank-option__title {
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.boursecu-bank-option__sheba {
|
|
margin-top: 4px;
|
|
font-size: 1rem;
|
|
font-weight: 700;
|
|
color: #111827;
|
|
direction: ltr;
|
|
text-align: right;
|
|
letter-spacing: 0.01em;
|
|
font-variant-numeric: tabular-nums;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.boursecu-bank-option--compact .boursecu-bank-option__sheba {
|
|
font-size: 0.92rem;
|
|
}
|
|
</style>
|