Skip to content

Commit 9dff50e

Browse files
authored
Merge pull request #1015 from Sysvale/feature/add-padding-prop-to-list
Feature/add padding prop to list
2 parents 87e460b + a1ff16d commit 9dff50e

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sysvale/cuida",
3-
"version": "3.144.0",
3+
"version": "3.145.0",
44
"description": "A design system built by Sysvale, using storybook and Vue components",
55
"repository": {
66
"type": "git",

src/components/List.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,22 @@ const props = defineProps({
9595
type: Boolean,
9696
default: false,
9797
},
98+
/**
99+
* Define o valor do padding do item da lista. Os valores são múltiplos de 4px separados por
100+
* vírgula para vertical e horizontal (ex: '2, 4').
101+
*/
102+
padding: {
103+
type: String,
104+
default: '7, 3',
105+
},
98106
});
99107
100108
const resolveHover = computed(() => props.clickable ? 'pointer' : '');
109+
const resolvePadding = computed(() => {
110+
const [vertical, horizontal] = props.padding.replace(' ', '').split(',');
111+
112+
return `${vertical * 4}px ${horizontal * 4}px`;
113+
});
101114
102115
function resolveListClick(item) {
103116
if (!props.clickable && !isMobile.value) {
@@ -114,7 +127,7 @@ function resolveListClick(item) {
114127
115128
.list {
116129
border-bottom: none;
117-
padding: tokens.pYX(7, 3);
130+
padding: v-bind(resolvePadding);
118131
display: flex;
119132
justify-content: space-between;
120133

src/stories/components/List.stories.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import IconButton from '../../components/IconButton.vue';
3232
source: {
3333
language: 'html',
3434
format:true,
35-
code: /*html*/
35+
code: /*html*/
3636
`<cds-
3737
:items="[
3838
{
@@ -113,6 +113,7 @@ export const items = [
113113
args={{
114114
items,
115115
clickable: false,
116+
padding: '7, 3',
116117
}}
117118
>
118119
{ Template.bind({}) }

0 commit comments

Comments
 (0)