Skip to content

Commit 1035c0d

Browse files
committed
feat: adjust a-button and a-select add a-dropdown
1 parent 48727ef commit 1035c0d

File tree

14 files changed

+728
-283
lines changed

14 files changed

+728
-283
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hyone-boot-startup:
2+
yarn install --frozen-lockfile
3+
yarn storybook:serve

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"core-js": "^3.6.5",
2929
"url-join": "^4.0.1",
3030
"vue": "^2.6.11",
31+
"vue-click-outside": "^1.1.0",
3132
"vue-prop-validation-helper": "^3.0.0"
3233
},
3334
"devDependencies": {
@@ -53,13 +54,13 @@
5354
"node-sass": "^5.0.0",
5455
"sass-loader": "^10.1.0",
5556
"sass-resources-loader": "^2.1.1",
57+
"semantic-release": "^17.4.4",
5658
"storybook-design-token": "^1.2.0",
5759
"style-loader": "^2.0.0",
5860
"vue-cli-plugin-storybook": "~2.1.0",
5961
"vue-jest": "^3.0.7",
6062
"vue-template-compiler": "^2.6.11",
61-
"webpack-bundle-analyzer": "^4.4.0",
62-
"semantic-release": "^17.4.4"
63+
"webpack-bundle-analyzer": "^4.4.0"
6364
},
6465
"eslintConfig": {
6566
"root": true,

src/components/atoms/a-button/__tests__/__snapshots__/a-button.spec.js.snap

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
exports[`AButton render correctly with attrs 1`] = `
44
"<button id=\\"my-first-component\\" data-test-id=\\"secondary\\" class=\\"a-button a-button--behavior-is-rounded a-button--variant-primary a-button--size-small\\">
55
<!---->
6-
<!----> <span class=\\"a-button__text\\">With many Itens</span></button>"
6+
<!----> <span class=\\"a-button__text\\">With many Itens</span>
7+
<!----></button>"
78
`;
89
910
exports[`AButton render correctly with default props 1`] = `
1011
"<button class=\\"a-button a-button--behavior-is-rounded a-button--variant-primary a-button--size-small\\">
1112
<!---->
12-
<!----> <span class=\\"a-button__text\\">My first test</span></button>"
13+
<!----> <span class=\\"a-button__text\\">My first test</span>
14+
<!----></button>"
1315
`;
1416
1517
exports[`AButton render correctly with different props 1`] = `
1618
"<button class=\\"a-button a-button--behavior-block a-button--variant-secondary a-button--size-small\\">
17-
<div class=\\"a-icon a-icon--size-inherit a-icon--color-primary a-button__icon\\"><i class=\\"fas fa-circle\\"></i></div>
19+
<div class=\\"a-icon a-icon--size-inherit a-icon--color-primary a-button__icon a-button__icon--position-left\\"><i class=\\"fas fa-circle\\"></i></div>
1820
<!----> <span class=\\"a-button__text\\">With many Itens</span>
21+
<!---->
1922
</button>"
2023
`;

src/components/atoms/a-button/a-button.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@
120120
display: flex;
121121
height: 100%;
122122
width: 16px;
123-
margin-right: var(--size-small);
123+
&--position-left {
124+
margin-right: var(--size-small);
125+
}
126+
&--position-right {
127+
margin-left: var(--size-small);
128+
}
124129
}
125130

126131
&__text {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ import AButton from './a-button.vue';
4646
components: { AButton },
4747
template: `
4848
<div>
49-
<a-button @click="action" icon="fas fa-home">Hello Button</a-button>
50-
<a-button @click="action" icon="fas fa-user">Hello Button</a-button>
49+
<a-button @click="action" icon="fas fa-home">Default</a-button>
50+
<a-button @click="action" icon="fas fa-user" icon-position="left">Left</a-button>
51+
<a-button @click="action" icon="fas fa-user" icon-position="right">Right</a-button>
5152
</div>
5253
`,
5354
methods: { action: action("clicked") }

src/components/atoms/a-button/a-button.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
v-on="$listeners"
1313
>
1414
<AIcon
15-
v-if="icon"
15+
v-if="icon && iconPosition === 'left'"
1616
:icon="icon"
1717
:color="iconColor"
18-
:class="{'a-button__icon': slotPassed}"
18+
:class="{'a-button__icon a-button__icon--position-left': slotPassed}"
1919
/>
2020
<AIcon
2121
v-if="isLoading"
@@ -28,6 +28,12 @@
2828
>
2929
<slot />
3030
</span>
31+
<AIcon
32+
v-if="icon && iconPosition === 'right'"
33+
:icon="icon"
34+
:color="iconColor"
35+
:class="{'a-button__icon a-button__icon--position-right': slotPassed}"
36+
/>
3137
</button>
3238
</template>
3339

@@ -40,6 +46,14 @@ export default {
4046
components: { AIcon },
4147
inheritAttrs: false,
4248
props: {
49+
iconPosition: {
50+
type: String,
51+
default: 'left',
52+
validator: shouldBeOneOf([
53+
'left',
54+
'right',
55+
]),
56+
},
4357
behavior: {
4458
type: String,
4559
default: '',

src/components/atoms/a-select/a-select.stories.mdx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,80 @@ import ASelect from './a-select.vue';
3030
</Story>
3131
</Canvas>
3232

33+
### With listenners use:
34+
35+
<Canvas>
36+
<Story name="With listenners use">
37+
{{
38+
components: { ASelect },
39+
data() {
40+
return {
41+
selected: 'blah',
42+
};
43+
},
44+
template: `
45+
<div style="height: 40vh;">
46+
<a-select
47+
@select="selected = $event"
48+
:value="selected"
49+
:options="['example1', 'Example 1']"
50+
/>
51+
<a-select
52+
@input="selected = $event"
53+
:value="selected"
54+
:options="['example1', 'Example 1']"
55+
/>
56+
<a-select
57+
@change="selected = $event"
58+
:value="selected"
59+
:options="['example1', 'Example 1']"
60+
/>
61+
{{ selected }}
62+
</div>
63+
`,
64+
}}
65+
</Story>
66+
</Canvas>
67+
68+
### Use with object with attrs, value and text:
69+
70+
<Canvas>
71+
<Story name="Use with object with attrs, value and text">
72+
{{
73+
components: { ASelect },
74+
data() {
75+
return {
76+
selected: '',
77+
};
78+
},
79+
template: `
80+
<div style="height: 40vh;">
81+
<a-select
82+
v-model="selected"
83+
:options="[{value: 'example1', text: 'EXAMPLE 1'}, { value: 'data1', text: 'DATA 1'}]"
84+
/>
85+
{{ selected }}
86+
</div>
87+
`,
88+
}}
89+
</Story>
90+
</Canvas>
91+
92+
### placeholder:
93+
94+
<Canvas>
95+
<Story name="placeholder">
96+
{{
97+
components: { ASelect },
98+
template: `
99+
<div>
100+
<a-select placeholder="placeholder" :options="['yes', 'no']" />
101+
</div>
102+
`,
103+
}}
104+
</Story>
105+
</Canvas>
106+
33107
### Sizes:
34108

35109
<Canvas>

0 commit comments

Comments
 (0)