Skip to content

Commit 97d3245

Browse files
committed
Add textAlign and padding features to Title component
1 parent 1dac0e1 commit 97d3245

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/atoms/Title.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ const CONFIG = useNestedProp({
1919
color: "",
2020
fontSize: 20,
2121
bold: true,
22+
textAlign: 'center',
23+
paddingLeft: 0,
24+
paddingRight: 0
2225
},
2326
subtitle: {
2427
cy: "",
2528
text: "",
2629
color: "",
2730
fontSize: 14,
28-
bold: false,
31+
bold: false
2932
},
3033
}
3134
});
@@ -35,22 +38,22 @@ const CONFIG = useNestedProp({
3538
<template>
3639
<div
3740
:data-cy="CONFIG.title.cy"
38-
:style="`width: 100%; text-align:center;color:${
41+
:style="`width: calc(100% - ${CONFIG.title.paddingLeft + CONFIG.title.paddingRight}px); text-align:${CONFIG.title.textAlign};color:${
3942
CONFIG.title.color
4043
};font-size:${CONFIG.title.fontSize}px;font-weight:${
4144
CONFIG.title.bold ? 'bold' : ''
42-
}`"
45+
};padding-left:${CONFIG.title.paddingLeft}px;padding-right:${CONFIG.title.paddingRight}px;`"
4346
>
4447
{{ CONFIG.title.text }}
4548
</div>
4649
<div
4750
:data-cy="CONFIG.subtitle.cy"
4851
v-if="CONFIG.subtitle.text"
49-
:style="`width: 100%; text-align:center;color:${
52+
:style="`width: calc(100% - ${CONFIG.title.paddingLeft + CONFIG.title.paddingRight}px); text-align:${CONFIG.title.textAlign};color:${
5053
CONFIG.subtitle.color
5154
};font-size:${CONFIG.subtitle.fontSize}px;font-weight:${
5255
CONFIG.subtitle.bold ? 'bold' : ''
53-
}`"
56+
};padding-left:${CONFIG.title.paddingLeft}px;padding-right:${CONFIG.title.paddingRight}px;`"
5457
>
5558
{{ CONFIG.subtitle.text }}
5659
</div>

src/useConfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export function useConfig() {
5252
color: COLOR_BLACK,
5353
fontSize: FONT._20,
5454
bold: true,
55+
textAlign: POSITION.CENTER,
56+
paddingLeft: 0,
57+
paddingRight: 0,
5558
subtitle: {
5659
color: COLOR_GREY,
5760
text: "",

types/vue-data-ui.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ declare module 'vue-data-ui' {
1515
color?: string;
1616
fontSize?: number;
1717
bold?: boolean;
18+
textAlign?: TextAlign;
19+
paddingLeft?: number;
20+
paddingRight?: number;
1821
subtitle?: {
1922
color?: string;
2023
text?: string;

0 commit comments

Comments
 (0)