Skip to content

Commit 9621a5e

Browse files
committed
feat: adjust button and radio
1 parent d453b55 commit 9621a5e

File tree

8 files changed

+76
-2
lines changed

8 files changed

+76
-2
lines changed

src/components/atoms/button/button.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
--h-button-text-decoration: none;
1717
--h-button-text-decoration--hover: none;
1818
--h-button-text-decoration--active: none;
19+
--h-button-padding: var(--size-base-small) var(--size-base-large);
1920
--h-button-color: inherit;
2021
--h-button-font-weight: 500;
2122
--h-button-border: none;
@@ -30,7 +31,7 @@
3031
display: inline-flex;
3132
font-weight: var(--h-button-font-weight);
3233
justify-content: center;
33-
padding: var(--size-base-small) var(--size-base-large);
34+
padding: var(--h-button-padding);
3435
position: relative;
3536
text-decoration: var(--h-button-text-decoration);
3637
transition: background-color 250ms, opacity 250ms;
@@ -165,6 +166,9 @@
165166
margin-top: var(--size-base-extra-small);
166167
margin-bottom: var(--size-base-extra-small);
167168
}
169+
&-only-icon {
170+
--h-button-padding: var(--size-base-small);
171+
}
168172
}
169173

170174
&__icon {

src/components/atoms/button/button.stories.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Items acessíveis tem margens automaticas.
175175
components: { HButton },
176176
template: `
177177
<div>
178-
<h-button @click="action" icon-right="fas fa-user" />
178+
<h-button @click="action" icon-right="fas fa-user" only-icon />
179179
</div>
180180
`,
181181
methods: { action: action("clicked") }

src/components/atoms/button/button.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
['h-button--behavior-is-rounded']: isRounded,
88
[`h-button--behavior-is-loading`]: isLoading,
99
[`h-button--behavior-is-accessible`]: isAccessible,
10+
[`h-button--behavior-only-icon`]: onlyIcon,
1011
[`h-button--color-${color}`]: color,
1112
[`h-button--size-${size}`]: size,
1213
[`h-button--variant-${variant}`]: variant,
@@ -119,6 +120,10 @@ export default {
119120
type: Boolean,
120121
default: false,
121122
},
123+
onlyIcon: {
124+
type: Boolean,
125+
default: false,
126+
},
122127
},
123128
computed: {
124129
slotPassed() {

src/components/atoms/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ export * from './text';
1414
export * from './suspense';
1515
export * from './loading';
1616
export * from './checkbox';
17+
export * from './radio';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import HRadio from './radio.vue';
2+
3+
export { HRadio };
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Meta, ArgsTable, Story, Canvas } from '@storybook/addon-docs';
2+
import { action } from '@storybook/addon-actions'
3+
import HRadio from './radio.vue';
4+
5+
<Meta title="Design System/Atoms/Radio" component={HRadio} />
6+
7+
## Checkbox
8+
9+
### Uso normal:
10+
11+
<Canvas>
12+
<Story name="Uso normal">
13+
{{
14+
components: { HRadio },
15+
data() {
16+
return {
17+
status: null,
18+
};
19+
},
20+
template: '<h-radio label="Checkbox" v-model="status" />',
21+
}}
22+
</Story>
23+
</Canvas>
24+
25+
<ArgsTable of={HRadio} />
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div class="h-radio">
3+
<div>
4+
<input type="radio">
5+
6+
<HIcon icon="fa-solid fa-circle" />
7+
</div>
8+
</div>
9+
</template>
10+
11+
<script>
12+
import { HIcon } from '@components/atoms/icon';
13+
14+
export default {
15+
name: 'HRadio',
16+
components: {
17+
HIcon,
18+
},
19+
};
20+
21+
</script>
22+
23+
<style lang="scss">
24+
.h-radio {
25+
display: flex;
26+
align-items: center;
27+
28+
--h-radio-main-color: var(--color-theme-secondary);
29+
--h-radio-background-color: transparent;
30+
--h-radio-border-color: var(--color-theme-primary);
31+
--h-radio-color: var(--colors-original-white);
32+
--h-radio__label--color: inherit;
33+
}
34+
</style>

src/plugins/core-ui-plugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
HSuspense,
1717
HLoading,
1818
HCheckbox,
19+
HRadio,
1920
} from '@components/atoms';
2021

2122
import {
@@ -50,6 +51,7 @@ const CoreUIPlugin = {
5051
Vue.component('HSuspense', HSuspense);
5152
Vue.component('HLoading', HLoading);
5253
Vue.component('HCheckbox', HCheckbox);
54+
Vue.component('HRadio', HRadio);
5355
},
5456
installMolecules(Vue) {
5557
Vue.component('HBreadcrumb', HBreadcrumb);

0 commit comments

Comments
 (0)