Skip to content

Commit 9a72b53

Browse files
authored
Replace Element plus button with custom component (#2935)
Signed-off-by: Sameh16 <sameh_mohamed16@hotmail.com> Signed-off-by: [Your Name] <your_email@example.com>
1 parent 25c3828 commit 9a72b53

File tree

123 files changed

+1133
-665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1133
-665
lines changed

frontend/components.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ export {}
99

1010
declare module '@vue/runtime-core' {
1111
export interface GlobalComponents {
12-
ElAvatar: typeof import('element-plus/es')['ElAvatar']
13-
ElButton: typeof import('element-plus/es')['ElButton']
1412
ElCard: typeof import('element-plus/es')['ElCard']
1513
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
1614
ElCollapse: typeof import('element-plus/es')['ElCollapse']

frontend/config/styles/components/button.scss

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,30 @@
8888
--lf-btn-secondary-loading-background: var(--lf-color-white);
8989
--lf-btn-secondary-loading-border: var(--lf-color-gray-200);
9090

91+
92+
/* Bordered */
93+
--lf-btn-bordered-text: var(--lf-color-gray-500);
94+
--lf-btn-bordered-background: var(--lf-color-white);
95+
--lf-btn-bordered-border: var(--lf-color-gray-250);
96+
--lf-btn-bordered-shadow: var(--shadow-default);
97+
// Hover
98+
--lf-btn-bordered-hover-text: var(--lf-color-primary-500);
99+
--lf-btn-bordered-hover-background: var(--lf-color-primary-125);
100+
--lf-btn-bordered-hover-border: var(--lf-color-primary-150);
101+
// Active
102+
--lf-btn-bordered-active-text: var(--lf-color-primary-500);
103+
--lf-btn-bordered-active-background: var(--lf-color-primary-125);
104+
--lf-btn-bordered-active-border: var(--lf-color-primary-500);
105+
// Disabled
106+
--lf-btn-bordered-disabled-text: var(--lf-color-gray-400);
107+
--lf-btn-bordered-disabled-background: var(--lf-color-white);
108+
--lf-btn-bordered-disabled-border: var(--lf-color-gray-100);
109+
// Loading
110+
--lf-btn-bordered-loading-text: var(--lf-color-gray-400);
111+
--lf-btn-bordered-loading-background: var(--lf-color-white);
112+
--lf-btn-bordered-loading-border: var(--lf-color-gray-200);
113+
114+
91115
/* Danger */
92116
--lf-btn-danger-text: var(--lf-color-white);
93117
--lf-btn-danger-background: var(--lf-color-red-500);
@@ -157,6 +181,30 @@
157181
--lf-btn-secondary-ghost-loading-border: var(--lf-color-transparent);
158182

159183

184+
/* Secondary Gray */
185+
--lf-btn-secondary-gray-text: var(--lf-color-primary-500);
186+
--lf-btn-secondary-gray-background: linear-gradient(180deg, var(--lf-color-white) 0%, var(--lf-color-gray-250) 100%);
187+
--lf-btn-secondary-gray-border: var(--lf-color-gray-250);
188+
--lf-btn-secondary-gray-shadow: var(--shadow-none);
189+
// Hover
190+
--lf-btn-secondary-gray-hover-text: var(--lf-color-primary-500);
191+
--lf-btn-secondary-gray-hover-background: linear-gradient(180deg, var(--lf-color-white) 0%, var(--lf-color-gray-250) 100%);
192+
--lf-btn-secondary-gray-hover-border: var(--lf-color-gray-250);
193+
// Active
194+
--lf-btn-secondary-gray-active-text: var(--lf-color-primary-500);
195+
--lf-btn-secondary-gray-active-background: linear-gradient(180deg, var(--lf-color-white) 0%, var(--lf-color-gray-250) 100%);
196+
--lf-btn-secondary-gray-active-border: var(--lf-color-gray-250);
197+
// Disabled
198+
--lf-btn-secondary-gray-disabled-text: var(--lf-color-gray-400);
199+
--lf-btn-secondary-gray-disabled-background: linear-gradient(180deg, var(--lf-color-white) 0%, var(--lf-color-gray-100) 100%);
200+
--lf-btn-secondary-gray-disabled-border: var(--lf-color-gray-100);
201+
// Loading
202+
--lf-btn-secondary-gray-loading-text: var(--lf-color-gray-400);
203+
--lf-btn-secondary-gray-loading-background: var(--lf-color-transparent);
204+
--lf-btn-secondary-gray-loading-border: var(--lf-color-transparent);
205+
206+
207+
160208
/* Secondary Ghost Light */
161209
--lf-btn-secondary-ghost-light-text: var(--lf-color-gray-500);
162210
--lf-btn-secondary-ghost-light-background: var(--lf-color-transparent);

frontend/config/styles/variables/_colors.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
--lf-color-primary-400: #33A9FF;
1919
--lf-color-primary-300: #66BFFF;
2020
--lf-color-primary-200: #99D4FF;
21+
--lf-color-primary-150: #c6e2ff;
22+
--lf-color-primary-125: #ecf5ff;
2123
--lf-color-primary-100: #CCEAFF;
2224
--lf-color-primary-50: #E6F4FF;
2325
--lf-color-primary-25: #F6FAFF;
@@ -38,6 +40,7 @@
3840
--lf-color-gray-500: #6B7280;
3941
--lf-color-gray-400: #9CA3AF;
4042
--lf-color-gray-300: #D1D5DB;
43+
--lf-color-gray-250: #e6e6e6;
4144
--lf-color-gray-200: #E5E7EB;
4245
--lf-color-gray-100: #F3F4F6;
4346
--lf-color-gray-50: #F9FAFB;

frontend/src/assets/scss/buttons.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@
180180
@apply mr-2;
181181
}
182182

183-
&.el-button + &.el-button {
184-
@apply ml-0;
185-
}
186183
}
187184

188185
.btn-group {
@@ -192,7 +189,3 @@
192189
.btn-group > .btn:not(:last-child) {
193190
@apply -mr-0.5;
194191
}
195-
196-
.el-button {
197-
--el-button-outline-color: transparent !important;
198-
}

frontend/src/assets/scss/filter.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
}
3838
}
3939

40-
&-trigger.el-button,
41-
&-trigger.el-button:focus:not(.is-expanded),
42-
.el-input-group__append &-trigger.el-button,
40+
&-trigger.c-btn,
41+
&-trigger.c-btn:focus:not(.is-expanded),
42+
.el-input-group__append &-trigger.c-btn,
4343
.el-input-group__append
44-
&-trigger.el-button:focus:not(.is-expanded) {
44+
&-trigger.c-btn:focus:not(.is-expanded) {
4545
@apply h-10 flex justify-center items-center py-0 px-4 bg-white border border-l-0 rounded-l-none border-gray-300 outline-none text-gray-600;
4646
transition: all 0.2s ease;
4747

@@ -56,7 +56,7 @@
5656
.filter-list-operator {
5757
@apply text-xs mb-4;
5858

59-
&-btn.el-button {
59+
&-btn.c-btn {
6060
@apply h-8 flex items-center p-2 bg-white border border-gray-300 outline-none text-gray-600 text-xs;
6161
transition: all 0.2s ease;
6262

frontend/src/config/charts/helpers/tooltip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ export const externalTooltipHandler = (
135135
);
136136

137137
if (!footerBtn && tooltip.footer) {
138-
footerBtn = document.createElement('el-button');
138+
footerBtn = document.createElement('button');
139139
footerBtn.id = 'custom-tooltip-footer-btn';
140140
tooltip.footer.forEach((lines) => {
141-
footerBtn.className = 'btn btn--sm btn--full btn--secondary mt-4';
141+
footerBtn.className = 'c-btn c-btn--small w-full c-btn--secondary-gray mt-4';
142142
footerBtn.innerText = lines;
143143
tooltipEl.appendChild(footerBtn);
144144
});

frontend/src/config/integrations/confluence/components/confluence-settings-drawer.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@close="cancel"
99
>
1010
<template #beforeTitle>
11-
<img class="w-6 h-6 mr-2" :src="logoUrl" alt="Confluence logo" />
11+
<img class="min-w-6 h-6 mr-2" :src="logoUrl" alt="Confluence logo" />
1212
</template>
1313
<template #content>
1414
<div class="text-gray-900 text-sm font-medium">
@@ -55,22 +55,25 @@
5555

5656
<template #footer>
5757
<div>
58-
<el-button
59-
class="btn btn--md btn--secondary mr-4"
58+
<lf-button
59+
type="secondary-gray"
60+
size="medium"
61+
class="mr-4"
6062
:disabled="loading"
6163
@click="cancel"
6264
>
6365
Cancel
64-
</el-button>
65-
<el-button
66+
</lf-button>
67+
<lf-button
6668
id="confluenceConnect"
69+
type="primary"
70+
size="medium"
6771
:disabled="$v.$invalid || !hasFormChanged || loading"
68-
class="btn btn--md btn--primary"
6972
:loading="loading"
7073
@click="connect"
7174
>
7275
{{ integration?.settings ? 'Update' : 'Connect' }}
73-
</el-button>
76+
</lf-button>
7477
</div>
7578
</template>
7679
</app-drawer>
@@ -87,6 +90,7 @@ import { mapActions } from '@/shared/vuex/vuex.helpers';
8790
import useProductTracking from '@/shared/modules/monitoring/useProductTracking';
8891
import { EventType, FeatureEventKey } from '@/shared/modules/monitoring/types/event';
8992
import { Platform } from '@/shared/modules/platform/types/Platform';
93+
import LfButton from '@/ui-kit/button/Button.vue';
9094
9195
const emit = defineEmits(['update:modelValue']);
9296
const props = defineProps({

frontend/src/config/integrations/devto/components/devto-connect-drawer.vue

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@close="cancel()"
99
>
1010
<template #beforeTitle>
11-
<img class="w-6 h-6 mr-2" :src="logoUrl" alt="DEV logo" />
11+
<img class="min-w-6 h-6 mr-2" :src="logoUrl" alt="DEV logo" />
1212
</template>
1313
<template #content>
1414
<el-form class="form integration-devto-form" @submit.prevent>
@@ -79,27 +79,29 @@
7979
/>
8080
</template>
8181
</el-input>
82-
<el-button
82+
<lf-button
8383
v-if="!isLastOrganization"
8484
:disabled="!isAPIConnectionValid"
85-
class="btn btn-link btn-link--md btn-link--primary w-10 h-10"
85+
type="primary-link"
86+
size="medium"
87+
class="w-10 h-10"
8688
@click="removeOrganization(org.id)"
8789
>
8890
<lf-icon name="trash-can" :size="20" class="text-black" />
89-
</el-button>
91+
</lf-button>
9092
</div>
9193
<span
9294
v-if="org.touched && !org.valid"
9395
class="el-form-item__error"
9496
>Organization slug is not valid</span>
9597
</el-form-item>
96-
<el-button
97-
class="btn btn-link btn-link--primary"
98+
<lf-button
99+
type="primary-link"
98100
:disabled="!isAPIConnectionValid"
99101
@click="addNewOrganization"
100102
>
101103
+ Add organization link
102-
</el-button>
104+
</lf-button>
103105
<span class="text-sm font-medium mt-8">Track user articles</span>
104106
<span
105107
class="text-2xs font-light mb-2 text-gray-600"
@@ -136,50 +138,55 @@
136138
/>
137139
</template>
138140
</el-input>
139-
<el-button
141+
<lf-button
140142
v-if="!isLastUser"
141143
:disabled="!isAPIConnectionValid"
142-
class="btn btn-link btn-link--md btn-link--primary w-10 h-10"
144+
type="primary-link"
145+
size="medium"
146+
class="w-10 h-10"
143147
@click="removeUser(user.id)"
144148
>
145149
<lf-icon name="trash-can" :size="20" class="text-black" />
146-
</el-button>
150+
</lf-button>
147151
</div>
148152
<span
149153
v-if="user.touched && !user.valid"
150154
class="el-form-item__error"
151155
>User slug is not valid</span>
152156
</el-form-item>
153-
<el-button
154-
class="btn btn-link btn-link--primary"
157+
<lf-button
158+
type="primary-link"
155159
:disabled="!isAPIConnectionValid"
156160
@click="addNewUser"
157161
>
158162
+ Add user link
159-
</el-button>
163+
</lf-button>
160164
</div>
161165
</el-form>
162166
</template>
163167
<template #footer>
164168
<div>
165-
<el-button
166-
class="btn btn--md btn--secondary mr-4"
169+
<lf-button
170+
type="secondary-gray"
171+
size="medium"
172+
class="mr-4"
167173
:disabled="loading"
168174
@click="cancel"
169175
>
170176
Cancel
171-
</el-button>
172-
<el-button
177+
</lf-button>
178+
<lf-button
173179
id="devConnect"
174-
class="btn btn--md btn--primary"
180+
type="primary"
181+
size="medium"
175182
:disabled="
176183
connectDisabled || loading || !isAPIConnectionValid || isValidating
177184
"
178185
:loading="loading"
179186
@click="save"
180187
>
181188
Connect
182-
</el-button>
189+
</lf-button>
183190
</div>
184191
</template>
185192
</app-drawer>
@@ -206,6 +213,7 @@ import useProductTracking from '@/shared/modules/monitoring/useProductTracking';
206213
import { EventType, FeatureEventKey } from '@/shared/modules/monitoring/types/event';
207214
import { Platform } from '@/shared/modules/platform/types/Platform';
208215
import LfIcon from '@/ui-kit/icon/Icon.vue';
216+
import LfButton from '@/ui-kit/button/Button.vue';
209217
210218
const { doDevtoConnect } = mapActions('integration');
211219

0 commit comments

Comments
 (0)