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

feat(editor): Main navigation redesign #4144

Merged
merged 39 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
aee8912
refactor(editor): N8N-4540 Main navigation layout rework (#4060)
MiloradFilipovic Sep 15, 2022
3b15c76
✨ Moved 'Workflows' menu to node view header. Added new dropdown com…
MiloradFilipovic Sep 15, 2022
4cc564a
💄 Updating disabled states in new WF menu
MiloradFilipovic Sep 15, 2022
0150e04
💄 Initial stab at new sidebar styling
MiloradFilipovic Sep 15, 2022
1a99621
✨ Finished main navigation restyling
MiloradFilipovic Sep 16, 2022
815161d
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 16, 2022
82dd101
Merge branch 'feature-main-nav-redesign' into N8N-4542-main-sidebar-n…
MiloradFilipovic Sep 16, 2022
cd3db90
✨ Updating `zoomToFit` and centering logic
MiloradFilipovic Sep 19, 2022
5073fca
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 19, 2022
8f0ff1b
Merge branch 'N8N-4542-main-sidebar-new-style' into feature-main-nav-…
MiloradFilipovic Sep 19, 2022
2d80d1d
✨ Adding updates menu item to settings sidebar
MiloradFilipovic Sep 19, 2022
e80827e
💄 Adding updates item to the settings sidebar and final touches on ma…
MiloradFilipovic Sep 19, 2022
c2fbb31
💄 Removing old code & refactoring
MiloradFilipovic Sep 19, 2022
ca3364c
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 19, 2022
a5ebb32
💄 Minor CSS tweaks
MiloradFilipovic Sep 20, 2022
31da5bc
💄 Opening credentials modal on sidebar menu item click. Minor CSS upd…
MiloradFilipovic Sep 20, 2022
3b8e182
💄 Updating sidebar expand/collapse animation
MiloradFilipovic Sep 20, 2022
ade2165
💄 Few more refinements of sidebar animation
MiloradFilipovic Sep 20, 2022
2391ab2
👌 Addressing code review comments
MiloradFilipovic Sep 20, 2022
985d842
✨ Moved ActionDropdown component to design system
MiloradFilipovic Sep 21, 2022
66670f1
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 21, 2022
7f9604b
👌 Fixing bugs reported during code review and testing
MiloradFilipovic Sep 21, 2022
7eb31bf
👌 Addressing design review comments for the new sidebar
MiloradFilipovic Sep 21, 2022
01c8763
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 21, 2022
98cfbef
✔️ Updating `N8nActionDropdown` component tests
MiloradFilipovic Sep 21, 2022
2862b21
✨ Remembering scroll position when going back to templates list
MiloradFilipovic Sep 22, 2022
9e2ec6b
✨ Updating zoomToFit logic to account for footer content
MiloradFilipovic Sep 22, 2022
bbef42d
👌 Addressing latest sidebar review comments
MiloradFilipovic Sep 22, 2022
682a163
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 23, 2022
89579a2
👌 Addressing main sidebar product review comments
MiloradFilipovic Sep 24, 2022
ead5186
Merge branch 'master' into feature-main-nav-redesign
MiloradFilipovic Sep 26, 2022
a823a75
💄 Updating css variable names after vite merge
MiloradFilipovic Sep 26, 2022
fbdffab
✔️ Fixing linting errors in the design system
MiloradFilipovic Sep 26, 2022
3e0edf9
✔️ Fixing `element-ui` type import
MiloradFilipovic Sep 26, 2022
023ba6d
👌 Addressing the code review comments.
MiloradFilipovic Sep 26, 2022
e925fc4
✨ Adding link to new credentials view, removed old modal
MiloradFilipovic Sep 26, 2022
e8487fe
💄 Updating credentials view responsiveness and route highlight handling
MiloradFilipovic Sep 26, 2022
68760fe
💄 Adding highlight to workflows submenu when on new workflow page
MiloradFilipovic Sep 26, 2022
186c58d
💄 Updated active submenu text color
MiloradFilipovic Sep 26, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import N8nActionDropdown from "./ActionDropdown.vue";
import { StoryFn } from '@storybook/vue';

export default {
title: 'Atoms/ActionDropdown',
component: N8nActionDropdown,
argTypes: {
placement: {
control: {
type: 'select',
options: ['top', 'top-end', 'top-start', 'bottom', 'bottom-end', 'bottom-start'],
},
},
activatorIcon: {
control: {
type: 'text',
},
},
trigger: {
control: {
type: 'select',
options: ['click', 'hover'],
},
},
},
};

const template: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nActionDropdown,
},
template: `<n8n-action-dropdown v-bind="$props" />`,
});

export const defaultActionDropdown = template.bind({});
defaultActionDropdown.args = {
items: [
{
id: 'item1',
label: 'Action 1',
},
{
id: 'item2',
label: 'Action 2',
},
],
};

export const customStyling = template.bind({});
customStyling.args = {
activatorIcon: 'bars',
items: [
{
id: 'item1',
label: 'Action 1',
icon: 'thumbs-up',
},
{
id: 'item2',
label: 'Action 2',
icon: 'thumbs-down',
disabled: true,
},
{
id: 'item3',
label: 'Action 3',
icon: 'heart',
divided: true,
},
],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<template>
<div :class="['action-dropdown-container', $style.actionDropdownContainer]">
<el-dropdown :placement="placement" :trigger="trigger" @command="onSelect">
<div :class="$style.activator">
<n8n-icon :icon="activatorIcon"/>
</div>
<el-dropdown-menu slot="dropdown" :class="$style.userActionsMenu">
<el-dropdown-item
v-for="item in items"
:key="item.id"
:command="item.id"
:disabled="item.disabled"
:divided="item.divided"
>
<div :class="{
[$style.itemContainer]: true,
[$style.hasCustomStyling]: item.customClass !== undefined,
[item.customClass]: item.customClass !== undefined,
}">
<span v-if="item.icon" :class="$style.icon">
<n8n-icon :icon="item.icon"/>
</span>
<span :class="$style.label">
{{ item.label }}
</span>
</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>

<script lang="ts">
import Vue, { PropType } from "vue";
import ElDropdown from 'element-ui/lib/dropdown';
import ElDropdownMenu from 'element-ui/lib/dropdown-menu';
import ElDropdownItem from 'element-ui/lib/dropdown-item';
import N8nIcon from '../N8nIcon';

interface IActionDropdownItem {
id: string;
label: string;
icon?: string;
divided?: boolean;
disabled?: boolean;
customClass?: string;
}

// This component is visually similar to the ActionToggle component
// but it offers more options when it comes to dropdown items styling
// (supports icons, separators, custom styling and all options provided
// by Element UI dropdown component).
// It can be used in different parts of editor UI while ActionToggle
// is designed to be used in card components.
export default Vue.extend({
name: 'n8n-action-dropdown',
components: {
ElDropdownMenu, // eslint-disable-line @typescript-eslint/no-unsafe-assignment
ElDropdown, // eslint-disable-line @typescript-eslint/no-unsafe-assignment
ElDropdownItem, // eslint-disable-line @typescript-eslint/no-unsafe-assignment
N8nIcon,
},
props: {
items: {
type: Array as PropType<IActionDropdownItem[]>,
required: true,
},
placement: {
type: String,
default: 'bottom',
validator: (value: string): boolean =>
['top', 'top-end', 'top-start', 'bottom', 'bottom-end', 'bottom-start'].includes(value),
},
activatorIcon: {
type: String,
default: 'ellipsis-v',
},
trigger: {
type: String,
default: 'click',
validator: (value: string): boolean =>
['click', 'hover'].includes(value),
},
},
methods: {
onSelect(action: string) : void {
this.$emit('select', action);
},
},
});

</script>

<style lang="scss" module>

.activator {
cursor: pointer;
padding: var(--spacing-2xs);
margin: 0;
border-radius: var(--border-radius-base);
line-height: normal !important;

svg {
position: static !important;
}

&:hover {
background-color: var(--color-background-base);
color: initial !important;
}
}

.itemContainer {
display: flex;
}

.icon {
text-align: center;
margin-right: var(--spacing-2xs);

svg { width: 1.2em !important; }
}

:global(li.is-disabled) {
.hasCustomStyling {
color: inherit !important;
}
}

</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { render } from '@testing-library/vue';
import N8nActionDropdown from '../ActionDropdown.vue';

describe('components', () => {
describe('N8nActionDropdown', () => {
it('should render default styling correctly', () => {
const wrapper = render(N8nActionDropdown, {
props: {
items: [
{
id: 'item1',
label: 'Action 1',
},
{
id: 'item2',
label: 'Action 2',
},
],
},
stubs: ['n8n-icon', 'el-dropdown', 'el-dropdown-menu', 'el-dropdown-item'],
});
expect(wrapper.html()).toMatchSnapshot();
});
it('should render custom styling correctly', () => {
const wrapper = render(N8nActionDropdown, {
props: {
items: [
{
id: 'item1',
label: 'Action 1',
icon: 'thumbs-up',
},
{
id: 'item2',
label: 'Action 2',
icon: 'thumbs-down',
disabled: true,
},
{
id: 'item3',
label: 'Action 3',
icon: 'heart',
divided: true,
},
],
},
stubs: ['n8n-icon', 'el-dropdown', 'el-dropdown-menu', 'el-dropdown-item'],
});
expect(wrapper.html()).toMatchSnapshot();
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Vitest Snapshot v1

exports[`components > N8nActionDropdown > should render custom styling correctly 1`] = `
"<div class=\\"action-dropdown-container\\">
<el-dropdown-stub trigger=\\"click\\" size=\\"\\" hideonclick=\\"true\\" placement=\\"bottom\\" visiblearrow=\\"true\\" showtimeout=\\"250\\" hidetimeout=\\"150\\" tabindex=\\"0\\">
<div class=\\"_activator_lf4ng_1\\">
<n8n-icon-stub icon=\\"ellipsis-v\\" size=\\"medium\\"></n8n-icon-stub>
</div>
<el-dropdown-menu-stub transformorigin=\\"true\\" placement=\\"bottom\\" boundariespadding=\\"5\\" offset=\\"0\\" visiblearrow=\\"true\\" arrowoffset=\\"0\\" appendtobody=\\"true\\" popperoptions=\\"[object Object]\\">
<el-dropdown-item-stub command=\\"item1\\">
<div class=\\"_itemContainer_lf4ng_16\\"><span class=\\"_icon_lf4ng_20\\"><n8n-icon-stub icon=\\"thumbs-up\\" size=\\"medium\\"></n8n-icon-stub></span><span> Action 1 </span></div>
</el-dropdown-item-stub>
<el-dropdown-item-stub command=\\"item2\\" disabled=\\"true\\">
<div class=\\"_itemContainer_lf4ng_16\\"><span class=\\"_icon_lf4ng_20\\"><n8n-icon-stub icon=\\"thumbs-down\\" size=\\"medium\\"></n8n-icon-stub></span><span> Action 2 </span></div>
</el-dropdown-item-stub>
<el-dropdown-item-stub command=\\"item3\\" divided=\\"true\\">
<div class=\\"_itemContainer_lf4ng_16\\"><span class=\\"_icon_lf4ng_20\\"><n8n-icon-stub icon=\\"heart\\" size=\\"medium\\"></n8n-icon-stub></span><span> Action 3 </span></div>
</el-dropdown-item-stub>
</el-dropdown-menu-stub>
</el-dropdown-stub>
</div>"
`;

exports[`components > N8nActionDropdown > should render default styling correctly 1`] = `
"<div class=\\"action-dropdown-container\\">
<el-dropdown-stub trigger=\\"click\\" size=\\"\\" hideonclick=\\"true\\" placement=\\"bottom\\" visiblearrow=\\"true\\" showtimeout=\\"250\\" hidetimeout=\\"150\\" tabindex=\\"0\\">
<div class=\\"_activator_lf4ng_1\\">
<n8n-icon-stub icon=\\"ellipsis-v\\" size=\\"medium\\"></n8n-icon-stub>
</div>
<el-dropdown-menu-stub transformorigin=\\"true\\" placement=\\"bottom\\" boundariespadding=\\"5\\" offset=\\"0\\" visiblearrow=\\"true\\" arrowoffset=\\"0\\" appendtobody=\\"true\\" popperoptions=\\"[object Object]\\">
<el-dropdown-item-stub command=\\"item1\\">
<div class=\\"_itemContainer_lf4ng_16\\">
<!----><span> Action 1 </span></div>
</el-dropdown-item-stub>
<el-dropdown-item-stub command=\\"item2\\">
<div class=\\"_itemContainer_lf4ng_16\\">
<!----><span> Action 2 </span></div>
</el-dropdown-item-stub>
</el-dropdown-menu-stub>
</el-dropdown-stub>
</div>"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import N8nActionDropdown from './ActionDropdown.vue';
export default N8nActionDropdown;
2 changes: 1 addition & 1 deletion packages/design-system/src/css/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ html {
body {
height: 100%;
width: 100%;
overscroll-behavior-x: none;
overscroll-behavior: none;
line-height: 1;
font-size: var(--font-size-m);
font-weight: var(--font-weight-regular);
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/plugins/n8nComponents.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Vue from 'vue';
import N8nActionBox from '../components/N8nActionBox';
import N8nActionDropdown from '../components/N8nActionDropdown';
import N8nActionToggle from '../components/N8nActionToggle';
import N8nAvatar from '../components/N8nAvatar';
import N8nBadge from "../components/N8nBadge";
Expand Down Expand Up @@ -46,6 +47,7 @@ export default {
install: (app: typeof Vue, options?: {}) => {
app.component('n8n-info-accordion', N8nInfoAccordion);
app.component('n8n-action-box', N8nActionBox);
app.component('n8n-action-dropdown', N8nActionDropdown);
app.component('n8n-action-toggle', N8nActionToggle);
app.component('n8n-avatar', N8nAvatar);
app.component('n8n-badge', N8nBadge);
Expand Down
Binary file modified packages/editor-ui/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/editor-ui/public/n8n-logo-collapsed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/editor-ui/public/n8n-logo-expanded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading