Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(component): Adiciona prop block no cds-button, para torná-lo fluido #613

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sysvale/cuida",
"version": "3.0.1",
"version": "3.1.0",
"description": "A design system built by Sysvale, using storybook and Vue components",
"repository": {
"type": "git",
Expand Down
16 changes: 14 additions & 2 deletions src/components/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</slot>
</button>
</template>

<script>
import CdsSpinner from '../components/Spinner.vue';
import Cdstip from '../utils/directives/cdstip';
Expand Down Expand Up @@ -49,6 +50,13 @@ export default {
type: String,
default: 'md',
},
/**
* Quando true, torna a largura do botão fluida
*/
block: {
type: Boolean,
default: false,
},
/**
* Especifica o texto a ser apresentado no corpo do botão.
* Este texto será exibido apenas se o slot default não for utilizado.
Expand Down Expand Up @@ -111,6 +119,9 @@ export default {
},

computed: {
widthResolver() {
return this.block ? '100%' : 'max-content';
},

tooltipDisabled() {
return this.disabled && this.tooltipText !== '' ? this.tooltipText : null;
Expand Down Expand Up @@ -188,7 +199,8 @@ export default {
font-family: Satoshi, Inter, Avenir, Helvetica, Arial, sans-serif;
display: flex;
align-items: center;
width: max-content;
justify-content: center;
width: v-bind(widthResolver);
border: none;
cursor: pointer;

Expand Down Expand Up @@ -282,7 +294,7 @@ export default {

&--lg {
@include button-1;
padding: pYX(3, 6);
padding: pYX(4, 8);
border-radius: $border-radius-extra-small;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/stories/components/Button.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Nesse caso, recomendamos o uso de links.
variant: 'green',
size: 'md',
text: 'Button',
block: false,
}}
>
{ Template.bind({}) }
Expand Down
Loading