@dcrackel/hematournamentui 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +18 -18
- package/.gitattributes +2 -2
- package/.prettierignore +1 -1
- package/.storybook/main.js +18 -18
- package/.storybook/mockRoutes.js +9 -9
- package/.storybook/preview-head.html +3 -3
- package/.storybook/preview.js +17 -17
- package/LICENSE +21 -21
- package/README.md +83 -83
- package/dist/HemaTouranmentUI-lib.es.js +7060 -6920
- package/dist/HemaTouranmentUI-lib.umd.js +27 -27
- package/dist/style.css +1 -1
- package/index.html +12 -12
- package/package.json +58 -58
- package/postcss.config.js +6 -6
- package/prettier.config.js +10 -10
- package/src/index.js +25 -25
- package/src/main.js +2 -2
- package/src/mocks/fileMock.js +1 -1
- package/src/mocks/tournamentMock.js +34 -34
- package/src/stories/Atoms/Icon/BaseIcon.stories.js +54 -54
- package/src/stories/Atoms/Icon/BaseIcon.test.js +91 -91
- package/src/stories/Atoms/Icon/BaseIcon.vue +48 -48
- package/src/stories/Atoms/Input/BaseInput.stories.js +29 -28
- package/src/stories/Atoms/Input/BaseInput.test.js +87 -87
- package/src/stories/Atoms/Input/BaseInput.vue +85 -73
- package/src/stories/Atoms/RadioGroup/BaseRadioGroup.stories.js +31 -31
- package/src/stories/Atoms/RadioGroup/BaseRadioGroup.test.js +49 -49
- package/src/stories/Atoms/RadioGroup/BaseRadioGroup.vue +49 -49
- package/src/stories/Atoms/Tag/BaseTag.stories.js +29 -29
- package/src/stories/Atoms/Tag/BaseTag.test.js +42 -42
- package/src/stories/Atoms/Tag/BaseTag.vue +57 -57
- package/src/stories/Atoms/Text/BaseText.stories.js +77 -77
- package/src/stories/Atoms/Text/BaseText.test.js +172 -172
- package/src/stories/Atoms/Text/BaseText.vue +170 -170
- package/src/stories/Configure.mdx +320 -320
- package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.stories.js +41 -41
- package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.test.js +80 -80
- package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.vue +31 -31
- package/src/stories/Molecules/Button/BaseButton.stories.js +93 -76
- package/src/stories/Molecules/Button/BaseButton.test.js +147 -147
- package/src/stories/Molecules/Button/BaseButton.vue +116 -125
- package/src/stories/Molecules/Cards/Detail/TournamentCardDetail.stories.js +33 -33
- package/src/stories/Molecules/Cards/Detail/TournamentCardDetail.vue +38 -38
- package/src/stories/Molecules/Cards/Header/TournamentCardHeader.stories.js +48 -48
- package/src/stories/Molecules/Cards/Header/TournamentCardHeader.vue +40 -40
- package/src/stories/Molecules/Filters/FilterAndSortBar/FilterAndSortBar.stories.js +36 -36
- package/src/stories/Molecules/Filters/FilterAndSortBar/FilterAndSortBar.vue +49 -49
- package/src/stories/Molecules/Filters/FilterUpcomingPast/FilterUpcomingPast.stories.js +32 -32
- package/src/stories/Molecules/Filters/FilterUpcomingPast/FilterUpcomingPast.vue +46 -46
- package/src/stories/Organisms/AddressAutocomplete/AddressAutocomplete.stories.js +25 -25
- package/src/stories/Organisms/AddressAutocomplete/AddressAutocomplete.vue +51 -51
- package/src/stories/Organisms/DatePicker/DatePicker.stories.js +25 -25
- package/src/stories/Organisms/DatePicker/DatePicker.vue +62 -62
- package/src/stories/Organisms/DropDown/DropDownMenu.stories.js +34 -34
- package/src/stories/Organisms/DropDown/DropDownMenu.vue +51 -51
- package/src/stories/Organisms/Grid/GridContainer.stories.js +47 -47
- package/src/stories/Organisms/Grid/GridContainer.vue +108 -108
- package/src/stories/Organisms/ImageCropper/ImageCropper.stories.js +28 -28
- package/src/stories/Organisms/ImageCropper/ImageCropper.vue +86 -86
- package/src/stories/Organisms/TextBoxEditor/TextBoxEditor.stories.js +28 -28
- package/src/stories/Organisms/TextBoxEditor/TextBoxEditor.vue +97 -97
- package/src/stories/Organisms/TournamentCard/TournamentCard.stories.js +37 -37
- package/src/stories/Organisms/TournamentCard/TournamentCard.vue +35 -35
- package/src/stories/Templates/Forms/AddTournamentPageOne/AddTournamentPageOne.stories.js +25 -25
- package/src/stories/Templates/Forms/AddTournamentPageOne/AddTournamentPageOne.vue +138 -137
- package/src/stories/Templates/Forms/AddTournamentPageTwo/AddTournamentPageTwo.stories.js +35 -0
- package/src/stories/Templates/Forms/AddTournamentPageTwo/AddTournamentPageTwo.vue +121 -0
- package/src/stories/Templates/Menu/Admin/AdminLeftMenu.stories.js +28 -28
- package/src/stories/Templates/Menu/Admin/AdminLeftMenu.vue +57 -57
- package/tailwind/output.css +1247 -1212
- package/tailwind/tailwind.css +4 -4
- package/tailwind.config.js +50 -50
- package/vite.config.js +23 -23
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import BaseButton from './BaseButton.vue';
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import { describe, expect, test, it } from "vitest";
|
|
4
|
-
|
|
5
|
-
describe('BaseButton.vue', () => {
|
|
6
|
-
|
|
7
|
-
it('renders the correct label', () => {
|
|
8
|
-
const wrapper = mount(BaseButton, {
|
|
9
|
-
props: { label: 'Test Button', size: 'lg' }
|
|
10
|
-
});
|
|
11
|
-
expect(wrapper.text()).toContain('Test Button');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('renders icon when iconName is provided', () => {
|
|
15
|
-
const iconName = 'some-icon-name';
|
|
16
|
-
const wrapper = mount(BaseButton, {
|
|
17
|
-
props: { label: 'Test Button', iconName: iconName }
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const iconElement = wrapper.find('[data-testid="base-icon"]');
|
|
21
|
-
expect(iconElement.exists()).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('emits click event when clicked', async () => {
|
|
25
|
-
const wrapper = mount(BaseButton, {
|
|
26
|
-
props: { label: 'Test Button', size: 'sm' }
|
|
27
|
-
})
|
|
28
|
-
await wrapper.trigger('click')
|
|
29
|
-
expect(wrapper.emitted().click).toHaveLength(1)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('computes correct classes based on type and size', () => {
|
|
33
|
-
const wrapper = mount(BaseButton, {
|
|
34
|
-
props: { label: 'Test Button', type: 'primary', size: 'md' }
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const baseTextElement = wrapper.find('[data-testid="base-text"]');
|
|
38
|
-
expect(baseTextElement.classes()).toContain('text-md');
|
|
39
|
-
expect(baseTextElement.classes()).toContain('text-primary');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('computes correct classes based on primary and selected', () => {
|
|
43
|
-
const wrapper = mount(BaseButton, {
|
|
44
|
-
props: { label: 'Test Button', type: 'primary', size: 'md', selected: true }
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
48
|
-
expect(baseTextElement.classes()).toContain('bg-dropdownSelect');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('computes correct classes based secondary type', () => {
|
|
52
|
-
const wrapper = mount(BaseButton, {
|
|
53
|
-
props: { label: 'Test Button', type: 'secondary', size: 'xl' }
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
57
|
-
expect(baseTextElement.classes()).toContain('text-xl');
|
|
58
|
-
expect(baseTextElement.classes()).toContain('bg-secondary');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('computes correct classes based secondary type and selected', () => {
|
|
62
|
-
const wrapper = mount(BaseButton, {
|
|
63
|
-
props: { label: 'Test Button', type: 'secondary', size: 'xl', selected:true }
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
67
|
-
expect(baseTextElement.classes()).toContain('bg-dropdownSelect');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('computes correct classes based tertiary type', () => {
|
|
71
|
-
const wrapper = mount(BaseButton, {
|
|
72
|
-
props: { label: 'Test Button', type: 'tertiary', size: 'lg' }
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
76
|
-
expect(baseTextElement.classes()).toContain('text-lg');
|
|
77
|
-
expect(baseTextElement.classes()).toContain('bg-tertiary');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('computes correct classes based tertiary type and selected', () => {
|
|
81
|
-
const wrapper = mount(BaseButton, {
|
|
82
|
-
props: { label: 'Test Button', type: 'tertiary', size: 'xl', selected:true }
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
86
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('computes correct classes based bright type', () => {
|
|
90
|
-
const wrapper = mount(BaseButton, {
|
|
91
|
-
props: { label: 'Test Button', type: 'bright', size: 'xs' }
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
95
|
-
expect(baseTextElement.classes()).toContain('text-xs');
|
|
96
|
-
expect(baseTextElement.classes()).toContain('bg-bright');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('computes correct classes based bright type and selected', () => {
|
|
100
|
-
const wrapper = mount(BaseButton, {
|
|
101
|
-
props: { label: 'Test Button', type: 'bright', size: 'xl', selected:true }
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
105
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('computes correct classes based admin', () => {
|
|
109
|
-
const wrapper = mount(BaseButton, {
|
|
110
|
-
props: { label: 'Test Button', type: 'admin', size: 'xs', hoverColor: 'admin'}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
114
|
-
expect(baseTextElement.classes()).toContain('text-xs');
|
|
115
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('computes correct classes based admin type and selected', () => {
|
|
119
|
-
const wrapper = mount(BaseButton, {
|
|
120
|
-
props: { label: 'Test Button', type: 'admin', size: 'xl', selected:true }
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
124
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('computes correct classes based admin secondary', () => {
|
|
128
|
-
const wrapper = mount(BaseButton, {
|
|
129
|
-
props: { label: 'Test Button', type: 'adminSecondary', size: 'xs', hoverColor: 'adminSecondary' }
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
133
|
-
expect(baseTextElement.classes()).toContain('text-xs');
|
|
134
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('computes correct classes based admin secondary type and selected', () => {
|
|
138
|
-
const wrapper = mount(BaseButton, {
|
|
139
|
-
props: {label: 'Test Button', type: 'adminSecondary', size: 'xl', selected:true}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
143
|
-
expect(baseTextElement.classes()).toContain('text-xl');
|
|
144
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
})
|
|
1
|
+
import BaseButton from './BaseButton.vue';
|
|
2
|
+
import { mount } from "@vue/test-utils";
|
|
3
|
+
import { describe, expect, test, it } from "vitest";
|
|
4
|
+
|
|
5
|
+
describe('BaseButton.vue', () => {
|
|
6
|
+
|
|
7
|
+
it('renders the correct label', () => {
|
|
8
|
+
const wrapper = mount(BaseButton, {
|
|
9
|
+
props: { label: 'Test Button', size: 'lg' }
|
|
10
|
+
});
|
|
11
|
+
expect(wrapper.text()).toContain('Test Button');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('renders icon when iconName is provided', () => {
|
|
15
|
+
const iconName = 'some-icon-name';
|
|
16
|
+
const wrapper = mount(BaseButton, {
|
|
17
|
+
props: { label: 'Test Button', iconName: iconName }
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const iconElement = wrapper.find('[data-testid="base-icon"]');
|
|
21
|
+
expect(iconElement.exists()).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('emits click event when clicked', async () => {
|
|
25
|
+
const wrapper = mount(BaseButton, {
|
|
26
|
+
props: { label: 'Test Button', size: 'sm' }
|
|
27
|
+
})
|
|
28
|
+
await wrapper.trigger('click')
|
|
29
|
+
expect(wrapper.emitted().click).toHaveLength(1)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('computes correct classes based on type and size', () => {
|
|
33
|
+
const wrapper = mount(BaseButton, {
|
|
34
|
+
props: { label: 'Test Button', type: 'primary', size: 'md' }
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const baseTextElement = wrapper.find('[data-testid="base-text"]');
|
|
38
|
+
expect(baseTextElement.classes()).toContain('text-md');
|
|
39
|
+
expect(baseTextElement.classes()).toContain('text-primary');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('computes correct classes based on primary and selected', () => {
|
|
43
|
+
const wrapper = mount(BaseButton, {
|
|
44
|
+
props: { label: 'Test Button', type: 'primary', size: 'md', selected: true }
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
48
|
+
expect(baseTextElement.classes()).toContain('bg-dropdownSelect');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('computes correct classes based secondary type', () => {
|
|
52
|
+
const wrapper = mount(BaseButton, {
|
|
53
|
+
props: { label: 'Test Button', type: 'secondary', size: 'xl' }
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
57
|
+
expect(baseTextElement.classes()).toContain('text-xl');
|
|
58
|
+
expect(baseTextElement.classes()).toContain('bg-secondary');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('computes correct classes based secondary type and selected', () => {
|
|
62
|
+
const wrapper = mount(BaseButton, {
|
|
63
|
+
props: { label: 'Test Button', type: 'secondary', size: 'xl', selected:true }
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
67
|
+
expect(baseTextElement.classes()).toContain('bg-dropdownSelect');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('computes correct classes based tertiary type', () => {
|
|
71
|
+
const wrapper = mount(BaseButton, {
|
|
72
|
+
props: { label: 'Test Button', type: 'tertiary', size: 'lg' }
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
76
|
+
expect(baseTextElement.classes()).toContain('text-lg');
|
|
77
|
+
expect(baseTextElement.classes()).toContain('bg-tertiary');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('computes correct classes based tertiary type and selected', () => {
|
|
81
|
+
const wrapper = mount(BaseButton, {
|
|
82
|
+
props: { label: 'Test Button', type: 'tertiary', size: 'xl', selected:true }
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
86
|
+
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('computes correct classes based bright type', () => {
|
|
90
|
+
const wrapper = mount(BaseButton, {
|
|
91
|
+
props: { label: 'Test Button', type: 'bright', size: 'xs' }
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
95
|
+
expect(baseTextElement.classes()).toContain('text-xs');
|
|
96
|
+
expect(baseTextElement.classes()).toContain('bg-bright');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('computes correct classes based bright type and selected', () => {
|
|
100
|
+
const wrapper = mount(BaseButton, {
|
|
101
|
+
props: { label: 'Test Button', type: 'bright', size: 'xl', selected:true }
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
105
|
+
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('computes correct classes based admin', () => {
|
|
109
|
+
const wrapper = mount(BaseButton, {
|
|
110
|
+
props: { label: 'Test Button', type: 'admin', size: 'xs', hoverColor: 'admin'}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
114
|
+
expect(baseTextElement.classes()).toContain('text-xs');
|
|
115
|
+
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('computes correct classes based admin type and selected', () => {
|
|
119
|
+
const wrapper = mount(BaseButton, {
|
|
120
|
+
props: { label: 'Test Button', type: 'admin', size: 'xl', selected:true }
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
124
|
+
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('computes correct classes based admin secondary', () => {
|
|
128
|
+
const wrapper = mount(BaseButton, {
|
|
129
|
+
props: { label: 'Test Button', type: 'adminSecondary', size: 'xs', hoverColor: 'adminSecondary' }
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
133
|
+
expect(baseTextElement.classes()).toContain('text-xs');
|
|
134
|
+
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('computes correct classes based admin secondary type and selected', () => {
|
|
138
|
+
const wrapper = mount(BaseButton, {
|
|
139
|
+
props: {label: 'Test Button', type: 'adminSecondary', size: 'xl', selected:true}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
143
|
+
expect(baseTextElement.classes()).toContain('text-xl');
|
|
144
|
+
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
})
|
|
@@ -1,125 +1,116 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button data-testid="base-button"
|
|
3
|
-
<BaseIcon v-if="iconName"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return `${baseClasses} ${typeClass} ${sizeClass}`;
|
|
118
|
-
}),
|
|
119
|
-
onClick() {
|
|
120
|
-
emit('click');
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<button :class="classes" data-testid="base-button" type="button" @click="onClick">
|
|
3
|
+
<BaseIcon v-if="iconName" :color="textColor" :icon-name="iconName" :size="size" :style="iconStyle"
|
|
4
|
+
data-testid="base-icon"/>
|
|
5
|
+
<BaseText :color="textColor" :size="size" :text="label" data-testid="base-text" weight="normal"/>
|
|
6
|
+
</button>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import {computed} from 'vue';
|
|
11
|
+
import BaseText from '../../Atoms/Text/BaseText.vue';
|
|
12
|
+
import BaseIcon from '../../Atoms/Icon/BaseIcon.vue';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'base-button',
|
|
16
|
+
components: {BaseText, BaseIcon},
|
|
17
|
+
props: {
|
|
18
|
+
label: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
iconName: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ''
|
|
25
|
+
},
|
|
26
|
+
iconStyle: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'fa-solid',
|
|
29
|
+
validator: value => ['fa-solid', 'fa-regular', 'fa-light', 'fa-thing'].includes(value)
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'sm',
|
|
34
|
+
validator: value => ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'].includes(value)
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'primary',
|
|
39
|
+
validator: value => ['primary', 'secondary', 'tertiary', 'bright', 'admin', 'adminSecondary', 'iconOnly', 'editor', 'square'].includes(value)
|
|
40
|
+
},
|
|
41
|
+
selected: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: ['click'],
|
|
47
|
+
|
|
48
|
+
setup(props, {emit}) {
|
|
49
|
+
const typeClasses = {
|
|
50
|
+
primary: 'p-2 items-center gap-2.5 text-center rounded-md shadow border border-dropdownSelect justify-center hover:bg-tertiary ' +
|
|
51
|
+
(props.selected ? 'bg-dropdownSelect' : 'bg-neutral'),
|
|
52
|
+
|
|
53
|
+
secondary: 'px-2.5 items-center gap-2.5 text-center my-1 p-3 border-b border-secondary hover:border-b hover:border-neutral w-full rounded-lg flex flex-row justify-center ' +
|
|
54
|
+
(props.selected ? 'bg-secondary' : 'bg-primary'),
|
|
55
|
+
|
|
56
|
+
tertiary: 'px-2.5 py-0.5 items-center gap-2.5 rounded-md text-center justify-center hover:bg-primary text-primary ' +
|
|
57
|
+
(props.selected ? 'bg-primary' : 'bg-tertiary'),
|
|
58
|
+
|
|
59
|
+
bright: 'px-2.5 py-0.5 items-center gap-2.5 rounded-md text-center justify-center hover:bg-primary text-neutral ' +
|
|
60
|
+
(props.selected ? 'bg-primary' : 'bg-bright'),
|
|
61
|
+
|
|
62
|
+
admin: 'px-2.5 py-2 items-center rounded-md gap-2.5 text-center my-1 text-neutral hover:bg-primaryHighlight ' +
|
|
63
|
+
(props.selected ? 'bg-primary' : 'bg-primary'),
|
|
64
|
+
|
|
65
|
+
adminSecondary: 'px-2.5 py-0.5 items-center gap-2.5 text-center my-1 pb-0.5 border-b border-secondary hover:border-b hover:border-neutral w-11/12 text-neutral ' +
|
|
66
|
+
(props.selected ? 'bg-primary' : 'bg-primary'),
|
|
67
|
+
|
|
68
|
+
iconOnly: 'px-0.5 items-center rounded-full text-center text-tertiary shadow border border-dropdownSelect justify-center bg-primaryHighlight',
|
|
69
|
+
|
|
70
|
+
editor: 'px-1 items-center rounded-md text-center justify-center hover:bg-tertiary',
|
|
71
|
+
|
|
72
|
+
square: 'p-8 my-3 items-center gap-2.5 rounded-md text-center shadow border border-dropdownSelect justify-center hover:bg-tertiary ' +
|
|
73
|
+
(props.selected ? 'bg-dropdownSelect' : 'bg-neutral'),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const sizeClasses = {
|
|
77
|
+
xs: 'text-xs',
|
|
78
|
+
sm: 'text-sm',
|
|
79
|
+
md: 'text-md',
|
|
80
|
+
lg: 'text-lg',
|
|
81
|
+
xl: 'text-xl',
|
|
82
|
+
'2xl': 'text-2xl',
|
|
83
|
+
'3xl': 'text-3xl',
|
|
84
|
+
'4xl': 'text-4xl',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
textColor: computed(() => {
|
|
89
|
+
const colorMap = {
|
|
90
|
+
primary: 'primary',
|
|
91
|
+
secondary: 'neutral',
|
|
92
|
+
tertiary: 'tertiary',
|
|
93
|
+
bright: 'bright',
|
|
94
|
+
admin: 'neutral',
|
|
95
|
+
adminSecondary: 'neutral',
|
|
96
|
+
iconOnly: 'neutral',
|
|
97
|
+
editor: props.selected ? 'bright' : 'quaternary',
|
|
98
|
+
square: 'primary'
|
|
99
|
+
};
|
|
100
|
+
return colorMap[props.type];
|
|
101
|
+
}),
|
|
102
|
+
classes: computed(() => {
|
|
103
|
+
let baseClasses = 'inline-flex';
|
|
104
|
+
|
|
105
|
+
let typeClass = typeClasses[props.type];
|
|
106
|
+
|
|
107
|
+
let sizeClass = sizeClasses[props.size];
|
|
108
|
+
return `${baseClasses} ${typeClass} ${sizeClass}`;
|
|
109
|
+
}),
|
|
110
|
+
onClick() {
|
|
111
|
+
emit('click');
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
</script>
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import TournamentCardDetail from './TournamentCardDetail.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Molecules/Cards/TournamentCardDetail',
|
|
5
|
-
component: TournamentCardDetail,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
argTypes: {
|
|
8
|
-
tournament: {
|
|
9
|
-
control: {
|
|
10
|
-
type: 'object'
|
|
11
|
-
},
|
|
12
|
-
defaultValue: {
|
|
13
|
-
name: 'Tournament Name',
|
|
14
|
-
description: 'Tournament Description',
|
|
15
|
-
date: '07 October, 2023',
|
|
16
|
-
closes: 'Registration closes 06 October, 2023',
|
|
17
|
-
location: 'Tournament Location - City, State'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const Default = {
|
|
24
|
-
args: {
|
|
25
|
-
tournament: {
|
|
26
|
-
name: 'Tournament Name',
|
|
27
|
-
description: 'Tournament Description',
|
|
28
|
-
date: '07 October, 2023',
|
|
29
|
-
closes: 'Registration closes 06 October, 2023',
|
|
30
|
-
location: 'Tournament Location - City, State'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
1
|
+
import TournamentCardDetail from './TournamentCardDetail.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Molecules/Cards/TournamentCardDetail',
|
|
5
|
+
component: TournamentCardDetail,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
tournament: {
|
|
9
|
+
control: {
|
|
10
|
+
type: 'object'
|
|
11
|
+
},
|
|
12
|
+
defaultValue: {
|
|
13
|
+
name: 'Tournament Name',
|
|
14
|
+
description: 'Tournament Description',
|
|
15
|
+
date: '07 October, 2023',
|
|
16
|
+
closes: 'Registration closes 06 October, 2023',
|
|
17
|
+
location: 'Tournament Location - City, State'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Default = {
|
|
24
|
+
args: {
|
|
25
|
+
tournament: {
|
|
26
|
+
name: 'Tournament Name',
|
|
27
|
+
description: 'Tournament Description',
|
|
28
|
+
date: '07 October, 2023',
|
|
29
|
+
closes: 'Registration closes 06 October, 2023',
|
|
30
|
+
location: 'Tournament Location - City, State'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|