Skip to content

Commit

Permalink
Merge pull request #613 from Sysvale/feat/button-block
Browse files Browse the repository at this point in the history
feat(component): Adiciona prop block no cds-button, para torná-lo fluido
  • Loading branch information
johnn1sbo3s authored Apr 18, 2024
2 parents 5264762 + e112c6a commit c398868
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
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

0 comments on commit c398868

Please sign in to comment.