Skip to content

Commit

Permalink
feat(Button): add new soft variant
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Jun 15, 2023
1 parent 71cefbc commit 3ec2ba5
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 3 deletions.
38 changes: 37 additions & 1 deletion packages/button/src/VBtn.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ Text.parameters = {
},
};

export const Soft = Template.bind({});
Soft.args = {color: 'primary', soft: true};
Soft.parameters = {
docs: {
source: {
code: '<v-btn color="primary" soft>Button</v-btn>',
},
},
};

export const Rounded = Template.bind({});
Rounded.args = {color: 'primary', rounded: true};
Rounded.parameters = {
Expand Down Expand Up @@ -394,9 +404,35 @@ export const ButtonGroup: Story<VBtnProps> = () => ({

export const DarkMode: Story<VBtnProps> = () => ({
components: {VBtnGroup, VBtnToolbar, VBtn},
setup() {
return {
colors,
variants: ['default', 'outlined', 'text', 'soft'],
};
},
template: `
<div class="dark dark:bg-neutral-900 dark:text-neutral-200 p-6">
<h3 class="font-semibold">Default</h3>
<h3 class="font-semibold my-2">Colors</h3>
<div class="flex flex-row gap-2">
<VBtn v-for="color in colors" :key="color" :color="color">
{{ color }}
</VBtn>
</div>
<h3 class="font-semibold mt-4 mb-3">Variants</h3>
<div
v-for="variant in variants"
:key="variant"
>
<p>{{ variant }}</p>
<div class="flex flex-row gap-2 mt-2">
<VBtn v-for="color in colors" :key="color" :color="color"
v-bind:[variant]="variant"
>
{{ color }}
</VBtn>
</div>
</div>
<h3 class="font-semibold mt-4">Default</h3>
<VBtnGroup class="w-full mt-2">
<VBtn>Button</VBtn>
<VBtn>Button</VBtn>
Expand Down
2 changes: 2 additions & 0 deletions packages/button/src/VBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Props {
href?: string;
text?: boolean;
outlined?: boolean;
soft?: boolean;
rounded?: boolean;
disabled?: boolean;
noRing?: boolean;
Expand Down Expand Up @@ -100,6 +101,7 @@ const classes = computed(() => {
'btn--block': props.block,
'btn--loading': props.loading,
'btn--text': props.text,
'btn--soft': props.soft,
'btn--flush': props.flush,
shadow: props.shadow,
},
Expand Down
24 changes: 22 additions & 2 deletions packages/themes/src/morpheme/_button.dark.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


.dark {
.btn {
// disabled
Expand Down Expand Up @@ -53,6 +51,17 @@
--btn-text-color: var(--color-gray-true-300);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-gray-true-50);
--btn-border-color: var(--color-gray-true-50);
--btn-text-color: var(--color-gray-true-600);

&:hover {
--btn-text-color: var(--color-gray-true-700);
}
}
}

&-dark {
Expand Down Expand Up @@ -88,6 +97,17 @@
--btn-text-color: var(--color-gray-300);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-gray-true-50);
--btn-border-color: var(--color-gray-true-50);
--btn-text-color: var(--color-gray-true-600);

&:hover {
--btn-text-color: var(--color-gray-true-700);
}
}
}
}
}
88 changes: 88 additions & 0 deletions packages/themes/src/morpheme/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@
--btn-text-color: var(--color-primary-700);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-primary-50);
--btn-border-color: var(--color-primary-50);
--btn-text-color: var(--color-primary-600);

&:hover {
--btn-text-color: var(--color-primary-700);
}
}
}

&-secondary {
Expand Down Expand Up @@ -137,6 +148,17 @@
--btn-text-color: var(--color-secondary-700);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-secondary-50);
--btn-border-color: var(--color-secondary-50);
--btn-text-color: var(--color-secondary-600);

&:hover {
--btn-text-color: var(--color-secondary-700);
}
}
}

&-default {
Expand Down Expand Up @@ -171,6 +193,17 @@
--btn-text-color: var(--color-gray-900);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-gray-50);
--btn-border-color: var(--color-gray-50);
--btn-text-color: var(--color-gray-600);

&:hover {
--btn-text-color: var(--color-gray-700);
}
}
}

&-info {
Expand Down Expand Up @@ -206,6 +239,17 @@
--btn-text-color: var(--color-info-700);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-info-50);
--btn-border-color: var(--color-info-50);
--btn-text-color: var(--color-info-600);

&:hover {
--btn-text-color: var(--color-info-700);
}
}
}

&-warning {
Expand Down Expand Up @@ -241,6 +285,17 @@
--btn-text-color: var(--color-warning-700);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-warning-50);
--btn-border-color: var(--color-warning-50);
--btn-text-color: var(--color-warning-600);

&:hover {
--btn-text-color: var(--color-warning-700);
}
}
}

&-success {
Expand Down Expand Up @@ -276,6 +331,17 @@
--btn-text-color: var(--color-success-700);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-success-50);
--btn-border-color: var(--color-success-50);
--btn-text-color: var(--color-success-600);

&:hover {
--btn-text-color: var(--color-success-700);
}
}
}

&-error {
Expand Down Expand Up @@ -311,6 +377,17 @@
--btn-text-color: var(--color-error-700);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-error-50);
--btn-border-color: var(--color-error-50);
--btn-text-color: var(--color-error-600);

&:hover {
--btn-text-color: var(--color-error-700);
}
}
}

&-dark {
Expand Down Expand Up @@ -346,6 +423,17 @@
--btn-text-color: var(--color-gray-900);
}
}

// soft
&.btn--soft {
--btn-bg-color: var(--color-gray-true-50);
--btn-border-color: var(--color-gray-true-50);
--btn-text-color: var(--color-gray-true-600);

&:hover {
--btn-text-color: var(--color-gray-true-700);
}
}
}

&:not(.btn--flush) {
Expand Down

0 comments on commit 3ec2ba5

Please sign in to comment.