Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Fix various element-plus styles #6571

Merged
merged 3 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 72 additions & 83 deletions packages/design-system/src/components/N8nButton/Button.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<button
:class="classes"
:disabled="disabled || loading"
:disabled="isDisabled"
:aria-disabled="ariaDisabled"
:aria-busy="ariaBusy"
aria-live="polite"
Expand All @@ -17,93 +17,81 @@
</button>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
<script setup lang="ts">
import N8nIcon from '../N8nIcon';
import N8nSpinner from '../N8nSpinner';
import { useCssModule, computed, useAttrs } from 'vue';

export default defineComponent({
name: 'n8n-button',
props: {
label: {
type: String,
default: '',
},
type: {
type: String,
default: 'primary',
validator: (value: string): boolean =>
['primary', 'secondary', 'tertiary', 'success', 'warning', 'danger'].includes(value),
},
size: {
type: String,
default: 'medium',
validator: (value: string): boolean =>
['xmini', 'mini', 'small', 'medium', 'large', 'xlarge'].includes(value),
},
loading: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
outline: {
type: Boolean,
default: false,
},
text: {
type: Boolean,
default: false,
},
icon: {
type: [String, Array],
},
block: {
type: Boolean,
default: false,
},
active: {
type: Boolean,
default: false,
},
float: {
type: String,
validator: (value: string): boolean => ['left', 'right'].includes(value),
},
square: {
type: Boolean,
default: false,
},
const $style = useCssModule();
const $attrs = useAttrs();

const props = defineProps({
label: {
type: String,
default: '',
},
type: {
type: String,
default: 'primary',
},
size: {
type: String,
default: 'medium',
},
loading: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
outline: {
type: Boolean,
default: false,
},
text: {
type: Boolean,
default: false,
},
components: {
N8nSpinner,
N8nIcon,
icon: {
type: [String, Array],
},
computed: {
ariaBusy(): 'true' | undefined {
return this.loading ? 'true' : undefined;
},
ariaDisabled(): 'true' | undefined {
return this.disabled ? 'true' : undefined;
},
classes(): string {
return (
`button ${this.$style.button} ${this.$style[this.type]}` +
`${this.size ? ` ${this.$style[this.size]}` : ''}` +
`${this.outline ? ` ${this.$style.outline}` : ''}` +
`${this.loading ? ` ${this.$style.loading}` : ''}` +
`${this.float ? ` ${this.$style[`float-${this.float}`]}` : ''}` +
`${this.text ? ` ${this.$style.text}` : ''}` +
`${this.disabled ? ` ${this.$style.disabled}` : ''}` +
`${this.block ? ` ${this.$style.block}` : ''}` +
`${this.active ? ` ${this.$style.active}` : ''}` +
`${this.icon || this.loading ? ` ${this.$style.withIcon}` : ''}` +
`${this.square ? ` ${this.$style.square}` : ''}`
);
},
block: {
type: Boolean,
default: false,
},
active: {
type: Boolean,
default: false,
},
float: {
type: String,
},
square: {
type: Boolean,
default: false,
},
});

const ariaBusy = computed(() => (props.loading ? 'true' : undefined));
const ariaDisabled = computed(() => (props.disabled ? 'true' : undefined));
const isDisabled = computed(() => props.disabled || props.loading);

const classes = computed(() => {
return (
`button ${$style.button} ${$style[props.type]}` +
`${props.size ? ` ${$style[props.size]}` : ''}` +
`${props.outline ? ` ${$style.outline}` : ''}` +
`${props.loading ? ` ${$style.loading}` : ''}` +
`${props.float ? ` ${$style[`float-${props.float}`]}` : ''}` +
`${props.text ? ` ${$style.text}` : ''}` +
`${props.disabled ? ` ${$style.disabled}` : ''}` +
`${props.block ? ` ${$style.block}` : ''}` +
`${props.active ? ` ${$style.active}` : ''}` +
`${props.icon || props.loading ? ` ${$style.withIcon}` : ''}` +
`${props.square ? ` ${$style.square}` : ''}`
);
});
</script>

Expand Down Expand Up @@ -178,7 +166,8 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
* Colors
*/

.secondary {
.secondary,
.btn--cancel {
--button-color: var(--color-primary);
--button-border-color: var(--color-primary);
--button-background-color: var(--color-background-xlight);
Expand Down
4 changes: 4 additions & 0 deletions packages/design-system/src/components/N8nSelect/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export default defineComponent({
},
computed: {
computedSize(): string | undefined {
if (this.size === 'medium') {
return 'default';
}

if (this.size === 'xlarge') {
return undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/css/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
color: var(--color-primary);
}

& [class*='el-icon-'] {
& .el-icon {
line-height: 0.9;

& + span {
Expand Down
4 changes: 4 additions & 0 deletions packages/design-system/src/css/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
@include mixins.b(overlay-dialog) {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: inherit;
justify-content: center;
padding-top: var(--spacing-2xl);
}

Expand Down
18 changes: 18 additions & 0 deletions packages/design-system/src/css/icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@
-moz-osx-font-smoothing: grayscale;
}

.el-icon {
--color: inherit;
height: 1em;
width: 1em;
line-height: 1em;
display: inline-flex;
justify-content: center;
align-items: center;
position: relative;
fill: currentColor;
color: var(--color);
font-size: inherit;

svg {
height: 1em;
width: 1em;
}
}
.el-icon-ice-cream-round:before {
content: '\e6a0';
}
Expand Down
22 changes: 16 additions & 6 deletions packages/design-system/src/css/message-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,23 @@
margin-left: 10px;
}

//& .btn--confirm {
// @include button.button-just-primary();
// @include button.button-medium();
//}
& .btn--confirm {
@include button.button-just-primary();
@include button.button-small();
}
//
//& .btn--cancel {
//}
& .btn--cancel {
@include button.button-small();
@include button.button-outline;

--button-active-background-color: var(--color-primary-tint-2);
--button-active-color: var(--color-primary);
--button-active-border-color: var(--color-primary);
--button-hover-background-color: var(--color-primary-tint-3);
--button-hover-color: var(--color-primary);
--button-hover-border-color: var(--color-primary);
--button-focus-outline-color: var(--color-primary-tint-1);
}
}

@include mixins.e(btns-reverse) {
Expand Down
8 changes: 4 additions & 4 deletions packages/design-system/src/css/notification.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@
}
}

.el-icon-success {
.el-icon.el-notification--success {
color: var.$notification-success-icon-color;
}

.el-icon-error {
.el-icon.el-notification--error {
color: var.$notification-danger-icon-color;
}

.el-icon-info {
.el-icon.el-notification--info {
color: var.$notification-info-icon-color;
}

.el-icon-warning {
.el-icon.el-notification--warning {
color: var.$notification-warning-icon-color;
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/design-system/src/css/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@
height: 42px;
}
}
&--default {
.el-tag {
padding: var(--spacing-5xs) var(--spacing-xs);
}
}
}
8 changes: 4 additions & 4 deletions packages/design-system/src/css/tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
box-sizing: border-box;
white-space: nowrap;

.el-icon-close {
.el-icon.el-tag__close {
border-radius: 50%;
text-align: center;
position: relative;
Expand Down Expand Up @@ -133,7 +133,7 @@
@include mixins.m(medium) {
padding: 12px;

.el-icon-close {
.el-icon.el-tag__close {
transform: scale(0.8);
}
}
Expand All @@ -143,7 +143,7 @@
padding: 0 8px;
line-height: 22px;

.el-icon-close {
.el-icon.el-tag__close {
transform: scale(0.8);
}
}
Expand All @@ -153,7 +153,7 @@
padding: 0 5px;
line-height: 18px;

.el-icon-close {
.el-icon.el-tag__close {
margin-left: -3px;
transform: scale(0.7);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/editor-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<router-view name="sidebar"></router-view>
</div>
<div id="content" :class="$style.content">
<keep-alive include="NodeView" :max="1">
<main>
<router-view />
</main>
</keep-alive>
<router-view v-slot="{ Component }">
<keep-alive include="NodeView" :max="1">
<component :is="Component" />
</keep-alive>
</router-view>
</div>
<Modals />
<Telemetry />
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default defineComponent({

<style lang="scss">
.dialog-wrapper {
.el-dialog {
&.el-dialog {
display: flex;
flex-direction: column;
max-width: var(--dialog-max-width, 80%);
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/TagsDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ export default defineComponent({
.tags-container {
$--max-input-height: 60px;

:deep(.el-select) {
.el-select__tags {
.el-select-tags-wrapper {
.el-tag {
OlegIvaniv marked this conversation as resolved.
Show resolved Hide resolved
max-height: $--max-input-height;
overflow-y: scroll;
overflow-x: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
:users="ownedByUsers"
:currentUserId="usersStore.currentUser.id"
:modelValue="modelValue.ownedBy"
size="medium"
@update:modelValue="setKeyValue('ownedBy', $event)"
/>
</enterprise-edition>
Expand All @@ -47,6 +48,7 @@
:users="sharedWithUsers"
:currentUserId="usersStore.currentUser.id"
:modelValue="modelValue.sharedWith"
size="medium"
@update:modelValue="setKeyValue('sharedWith', $event)"
/>
</enterprise-edition>
Expand Down
Loading