-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #607 from weni-ai/feature/new-default-funnel-compo…
…nent [ENGAGE-1894] Add new variant funnel and eslint typescript support
- Loading branch information
Showing
13 changed files
with
556 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
}, | ||
extends: ['@weni/eslint-config/vue3'], | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'import/extensions': 'off', | ||
'no-shadow': 'off', | ||
}, | ||
overrides: [ | ||
{ | ||
files: [ | ||
'**/__tests__/*.{j,t}s?(x)', | ||
'**/tests/unit/**/*.spec.{j,t}s?(x)', | ||
], | ||
env: { | ||
jest: true, | ||
}, | ||
}, | ||
], | ||
}; | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
}, | ||
extends: ['@weni/eslint-config/vue3'], | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'import/extensions': 'off', | ||
'no-shadow': 'off', | ||
}, | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
}, | ||
overrides: [ | ||
{ | ||
files: [ | ||
'**/__tests__/*.{j,t}s?(x)', | ||
'**/tests/unit/**/*.spec.{j,t}s?(x)', | ||
], | ||
env: { | ||
jest: true, | ||
}, | ||
}, | ||
], | ||
}; |
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
150 changes: 150 additions & 0 deletions
150
src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.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,150 @@ | ||
<template> | ||
<section class="unnnic-chart-funnel-base-container"> | ||
<section | ||
v-for="(step, index) in data" | ||
:key="index" | ||
:class="[ | ||
'unnnic-chart-funnel-base-item', | ||
{ 'first-item': index === 0, 'last-item': index === data.length - 1 }, | ||
]" | ||
> | ||
<section class="unnnic-chart-funnel-base-item__card"> | ||
<svg | ||
:width="step.svgWidth" | ||
:height="step.svgHeight" | ||
:viewBox="`0 0 ${step.svgWidth} ${step.svgHeight}`" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
class="funnel-svg" | ||
> | ||
<path | ||
:d="step.svgPath" | ||
:fill="step.color" | ||
/> | ||
</svg> | ||
</section> | ||
<section class="unnnic-chart-funnel-base-item__text"> | ||
<section class="unnnic-chart-funnel-base-item__text__values"> | ||
<p class="unnnic-chart-funnel-base-item__text__values-title"> | ||
{{ step.percentage }} | ||
</p> | ||
<p class="unnnic-chart-funnel-base-item__text__values-sub-title"> | ||
| {{ step.value }} | ||
</p> | ||
</section> | ||
<p class="unnnic-chart-funnel-base-item__text-description"> | ||
{{ step.description }} | ||
</p> | ||
</section> | ||
</section> | ||
</section> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
interface FunnelStep { | ||
percentage: number | string; | ||
value: number | string; | ||
description: string; | ||
color: string; | ||
svgPath: string; | ||
svgWidth: number; | ||
svgHeight: number; | ||
} | ||
defineProps<{ | ||
data: FunnelStep[]; | ||
}>(); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '../../../assets/scss/unnnic.scss'; | ||
.unnnic-chart-funnel-base-container { | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
} | ||
.unnnic-chart-funnel-base-item { | ||
display: flex; | ||
justify-content: flex-start; | ||
&__card { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
left: 0; | ||
bottom: -1px; | ||
width: 100%; | ||
height: 1px; | ||
background-color: $unnnic-color-neutral-soft; | ||
z-index: -1; | ||
} | ||
} | ||
&__text { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
position: relative; | ||
padding-left: 1rem; | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
left: 0; | ||
bottom: -1px; | ||
width: 100%; | ||
height: 1px; | ||
background-color: $unnnic-color-neutral-soft; | ||
z-index: -1; | ||
} | ||
&-description { | ||
margin: 0; | ||
color: $unnnic-color-neutral-dark; | ||
text-align: center; | ||
font-family: $unnnic-font-family-secondary; | ||
font-size: $unnnic-font-size-body-md; | ||
font-style: normal; | ||
font-weight: $unnnic-font-weight-regular; | ||
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md; | ||
} | ||
&__values { | ||
display: flex; | ||
&-title { | ||
margin: 0; | ||
color: $unnnic-color-neutral-dark; | ||
font-family: $unnnic-font-family-secondary; | ||
font-size: $unnnic-font-size-body-lg; | ||
font-style: normal; | ||
font-weight: $unnnic-font-weight-bold; | ||
line-height: $unnnic-font-size-body-lg + $unnnic-line-height-md; | ||
} | ||
&-sub-title { | ||
display: flex; | ||
align-items: end; | ||
margin: 0; | ||
color: $unnnic-color-neutral-cloudy; | ||
font-family: $unnnic-font-family-secondary; | ||
font-size: $unnnic-font-size-body-md; | ||
font-style: normal; | ||
font-weight: $unnnic-font-weight-regular; | ||
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md; | ||
} | ||
} | ||
} | ||
&:last-child .unnnic-chart-funnel-base-item__card::after, | ||
&:last-child .unnnic-chart-funnel-base-item__text::after { | ||
content: none; | ||
} | ||
} | ||
</style> |
65 changes: 65 additions & 0 deletions
65
src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelFiveRows.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,65 @@ | ||
<template> | ||
<ChartDefaultFunnelBase :data="rows" /> | ||
</template> | ||
|
||
<script> | ||
import ChartDefaultFunnelBase from './ChartDefaultFunnelBase.vue'; | ||
export default { | ||
name: 'UnnnicDefaultChartFunnelFiveRows', | ||
components: { | ||
ChartDefaultFunnelBase, | ||
}, | ||
props: { | ||
data: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
rows() { | ||
const { data } = this; | ||
return [ | ||
{ | ||
...data[0], | ||
svgPath: | ||
'M218.999 0H8C3.58172 0 0 3.58173 0 8.00001V92.4H201.798C205.539 92.4 208.781 89.8071 209.602 86.1572L226.803 9.75715C227.929 4.75524 224.126 0 218.999 0Z', | ||
svgWidth: 228, | ||
svgHeight: 92, | ||
}, | ||
{ | ||
...data[1], | ||
svgPath: | ||
'M192 0.399902H0L1.04385e-05 92.7999H163.476C167.174 92.7999 170.39 90.2656 171.254 86.6703L192 0.399902Z', | ||
svgWidth: 192, | ||
svgHeight: 92, | ||
}, | ||
{ | ||
...data[2], | ||
svgPath: | ||
'M152 0.800049H2.59253e-05L0 93.2001H123.948C127.661 93.2001 130.886 90.645 131.736 87.0302L152 0.800049Z', | ||
svgWidth: 152, | ||
svgHeight: 92, | ||
}, | ||
{ | ||
...data[3], | ||
svgPath: | ||
'M117 0.199951H0L2.21175e-05 92.6H86.3723C90.0018 92.6 93.1765 90.1566 94.1057 86.648L117 0.199951Z', | ||
svgWidth: 117, | ||
svgHeight: 92, | ||
}, | ||
{ | ||
...data[4], | ||
svgPath: | ||
'M79 0.600098H0L3.72103e-05 85.0001C3.91582e-05 89.4184 3.58177 93.0001 8.00004 93.0001H46.3116C49.8754 93.0001 53.0095 90.6427 53.9978 87.2187L79 0.600098Z', | ||
svgWidth: 79, | ||
svgHeight: 92, | ||
}, | ||
]; | ||
}, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.