-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): Add descriptive header to projects /workflow (#11203)
- Loading branch information
Showing
7 changed files
with
182 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/editor-ui/src/components/layouts/ResourceListHeader.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import ResourceListHeader from './ResourceListHeader.vue'; | ||
|
||
const renderComponent = createComponentRenderer(ResourceListHeader); | ||
|
||
describe('WorkflowHeader', () => { | ||
it('should render icon prop', () => { | ||
const icon = 'home'; | ||
const { container } = renderComponent({ props: { icon } }); | ||
expect(container.querySelector(`.fa-${icon}`)).toBeVisible(); | ||
}); | ||
test.each([ | ||
['title', 'title slot'], | ||
['subtitle', 'subtitle slot'], | ||
['actions', 'actions slot'], | ||
])('should render "%s" slot', (slot, content) => { | ||
const { getByText } = renderComponent({ props: { icon: 'home' }, slots: { [slot]: content } }); | ||
expect(getByText(content)).toBeVisible(); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
packages/editor-ui/src/components/layouts/ResourceListHeader.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script setup lang="ts"> | ||
import { N8nHeading, N8nText, N8nIcon } from 'n8n-design-system'; | ||
defineProps<{ icon: string }>(); | ||
</script> | ||
|
||
<template> | ||
<div :class="[$style.workflowHeader]"> | ||
<div :class="[$style.icon]"> | ||
<N8nIcon :icon color="text-light"></N8nIcon> | ||
</div> | ||
<div> | ||
<N8nHeading bold tag="h2" size="xlarge"> | ||
<slot name="title" /> | ||
</N8nHeading> | ||
<N8nText v-if="$slots.subtitle" size="small" color="text-light"> | ||
<slot name="subtitle" /> | ||
</N8nText> | ||
</div> | ||
<div v-if="$slots.actions" :class="[$style.actions]"> | ||
<slot name="actions"></slot> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" module> | ||
.workflowHeader { | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
padding-bottom: var(--spacing-m); | ||
min-height: 64px; | ||
} | ||
.icon { | ||
border: 1px solid var(--color-foreground-light); | ||
padding: 6px; | ||
border-radius: var(--border-radius-base); | ||
} | ||
.actions { | ||
margin-left: auto; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters