-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<template> | ||
<div class="ms-summary-card"> | ||
<h2 class="ms-summary-card-title title-h3">{{ $msTranslate(title) }}</h2> | ||
<template | ||
v-for="(row, index) in rows" | ||
:key="`ms-summary-card-row${index}`" | ||
> | ||
<div | ||
class="ms-summary-card-row" | ||
v-if="row.secondItem" | ||
> | ||
<ms-summary-card-item | ||
:label="row.item.label" | ||
:text="row.item.text" | ||
:error="row.item.error" | ||
:second-line="row.item.secondLine" | ||
/> | ||
<ms-summary-card-item | ||
:label="row.secondItem.label" | ||
:text="row.secondItem.text" | ||
:error="row.secondItem.error" | ||
:second-line="row.secondItem.secondLine" | ||
/> | ||
</div> | ||
<ms-summary-card-item | ||
v-else | ||
:label="row.item.label" | ||
:text="row.item.text" | ||
:error="row.item.error" | ||
:second-line="row.item.secondLine" | ||
/> | ||
</template> | ||
|
||
<ion-button | ||
class="update-button" | ||
fill="clear" | ||
@click="$emit('update')" | ||
> | ||
<ion-icon | ||
:icon="pencil" | ||
class="update-button__icon" | ||
/> | ||
{{ $msTranslate(buttonLabel) }} | ||
</ion-button> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { IonButton, IonIcon } from '@ionic/vue'; | ||
import { MsSummaryCardRowData } from '@lib/components/ms-card/types'; | ||
import MsSummaryCardItem from '@lib/components/ms-card/MsSummaryCardItem.vue'; | ||
import { pencil } from 'ionicons/icons'; | ||
import { Translatable } from '@lib/services'; | ||
withDefaults( | ||
defineProps<{ | ||
title: Translatable; | ||
buttonLabel?: Translatable; | ||
rows: MsSummaryCardRowData[]; | ||
}>(), | ||
{ | ||
buttonLabel: 'lib.components.msSummaryCard.updateButtonLabel', | ||
}, | ||
); | ||
defineEmits<{ | ||
(e: 'update'): void; | ||
}>(); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.ms-summary-card { | ||
h2 { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
display: flex; | ||
flex-direction: column; | ||
background: var(--parsec-color-light-secondary-background); | ||
border: 1px solid var(--parsec-color-light-secondary-disabled); | ||
border-radius: var(--parsec-radius-8); | ||
gap: 1rem; | ||
width: 100%; | ||
position: relative; | ||
padding: 1.5rem; | ||
&-title { | ||
color: var(--parsec-color-light-secondary-text); | ||
} | ||
&-row { | ||
display: flex; | ||
} | ||
.update-button { | ||
position: absolute; | ||
right: 1rem; | ||
top: 1rem; | ||
&__icon { | ||
margin-right: 0.5rem; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<div class="ms-summary-card-item"> | ||
<p class="ms-summary-card-item__label form-label">{{ $msTranslate(label) }}</p> | ||
<p class="ms-summary-card-item__text subtitles-normal">{{ text }}</p> | ||
<p | ||
v-show="error" | ||
class="form-error body" | ||
> | ||
{{ $msTranslate(error) }} | ||
</p> | ||
<div | ||
v-if="secondLine" | ||
class="ms-summary-card-item__text subtitles-normal" | ||
> | ||
{{ secondLine.text }} | ||
<p | ||
v-show="secondLine.error" | ||
class="form-error body" | ||
> | ||
{{ $msTranslate(secondLine.error) }} | ||
</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { MsSummaryCardItemData } from '@lib/components/ms-card/types'; | ||
defineProps<MsSummaryCardItemData>(); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.ms-summary-card-item { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
gap: 0.5rem; | ||
p { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
&__label { | ||
color: var(--parsec-color-light-secondary-soft-grey); | ||
} | ||
&__text { | ||
color: var(--parsec-color-light-primary-text); | ||
display: flex; | ||
gap: 0.5rem; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import MsSummaryCard from '@lib/components/ms-card/MsSummaryCard.vue'; | ||
import MsSummaryCardItem from '@lib/components/ms-card/MsSummaryCardItem.vue'; | ||
|
||
export * from '@lib/components/ms-card/types'; | ||
export * from '@lib/components/ms-card/utils'; | ||
|
||
export { MsSummaryCard, MsSummaryCardItem }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Translatable } from '@lib/services'; | ||
|
||
interface MsSummaryCardItemData { | ||
label: Translatable; | ||
text: string; | ||
error?: Translatable; | ||
secondLine?: { | ||
text: string; | ||
error?: Translatable; | ||
}; | ||
} | ||
|
||
interface MsSummaryCardRowData { | ||
item: MsSummaryCardItemData; | ||
secondItem?: MsSummaryCardItemData; | ||
} | ||
|
||
export type { MsSummaryCardItemData, MsSummaryCardRowData }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { MsSummaryCardItemData } from '@lib/components/ms-card/types'; | ||
import { Translatable } from '@lib/services'; | ||
|
||
function createSummaryCardItem( | ||
label: Translatable, | ||
text: string, | ||
error?: Translatable, | ||
secondLineText?: string, | ||
secondLineError?: Translatable, | ||
): MsSummaryCardItemData | undefined { | ||
if (!text) return; | ||
const item: MsSummaryCardItemData = { | ||
label, | ||
text, | ||
error, | ||
}; | ||
|
||
if (secondLineText) { | ||
item.secondLine = { | ||
text: secondLineText, | ||
error: secondLineError, | ||
}; | ||
} | ||
return item; | ||
} | ||
|
||
export { createSummaryCardItem }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters