@dktunited-techoff/techoff-suite-ui 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/{Button/Button.css → TsButton/TsButton.css} +18 -18
- package/src/components/TsButton/TsButton.tsx +34 -0
- package/src/components/{Button/Button.types.ts → TsButton/TsButton.types.ts} +1 -1
- package/src/components/{Button/__stories__/Button.stories.mdx → TsButton/__stories__/TsButton.stories.mdx} +4 -4
- package/src/components/{Icon/Icon.css → TsIcon/TsIcon.css} +4 -4
- package/src/components/TsIcon/TsIcon.tsx +13 -0
- package/src/components/TsIcon/TsIcon.types.ts +1 -0
- package/src/components/{Icon/__stories__/Icon.stories.mdx → TsIcon/__stories__/TsIcon.stories.mdx} +4 -4
- package/src/components/{Loader/Loader.css → TsLoader/TsLoader.css} +4 -4
- package/src/components/TsLoader/TsLoader.tsx +7 -0
- package/src/components/TsLoader/TsLoader.types.ts +1 -0
- package/src/components/{Loader/__stories__/Loader.stories.mdx → TsLoader/__stories__/TsLoader.stories.mdx} +3 -3
- package/src/index.ts +6 -11
- package/src/layouts/{Header/Header.css → TsHeader/TsHeader.css} +25 -25
- package/src/layouts/TsHeader/TsHeader.tsx +20 -0
- package/src/layouts/{Header/Header.types.ts → TsHeader/TsHeader.types.ts} +4 -4
- package/src/layouts/TsHeader/TsHeaderProfile.tsx +56 -0
- package/src/layouts/{Header/HeaderSearch.tsx → TsHeader/TsHeaderSearch.tsx} +12 -12
- package/src/layouts/{Header/__stories__/Header.stories.mdx → TsHeader/__stories__/TsHeader.stories.mdx} +12 -12
- package/src/layouts/{Navigation/Navigation.css → TsNavigation/TsNavigation.css} +12 -12
- package/src/layouts/TsNavigation/TsNavigation.tsx +54 -0
- package/src/layouts/TsNavigation/TsNavigation.types.ts +4 -0
- package/src/layouts/TsNavigation/__stories__/TsNavigation.stories.mdx +51 -0
- package/src/components/Button/Button.tsx +0 -34
- package/src/components/Icon/Icon.tsx +0 -13
- package/src/components/Icon/Icon.types.ts +0 -1
- package/src/components/Loader/Loader.tsx +0 -7
- package/src/components/Loader/Loader.types.ts +0 -1
- package/src/layouts/Header/Header.tsx +0 -20
- package/src/layouts/Header/HeaderProfile.tsx +0 -56
- package/src/layouts/Navigation/Navigation.tsx +0 -54
- package/src/layouts/Navigation/Navigation.types.ts +0 -4
- package/src/layouts/Navigation/__stories__/Navigation.stories.mdx +0 -51
- /package/src/components/{Icon → TsIcon}/icons/add-circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/add.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/alert-circle-filled.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/alert-circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/alert-triangle-filled.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/alert-triangle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-diagonal-collapse.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-diagonal-expand.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-down.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-go-back.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-left-right.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-left.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-right.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-up-down.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/arrow-up.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/award.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/check-circle-filled.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/check-circle-timer.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/check-circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/check-square-filled.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/check-square.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/check.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/chevron-down.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/chevron-left.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/chevron-right.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/chevron-up.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/close-circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/close.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/currency-euro.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/download.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/edit.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/external-link.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/filter-off.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/filter.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/flashlight-off.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/flashlight.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/header-bikestudio.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/header-nsc-helmet.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/header-opticost.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/header-repairability.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/heart-filled.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/heart.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/history.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/home.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/index.ts +0 -0
- /package/src/components/{Icon → TsIcon}/icons/link.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/list-settings.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/lock.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/loop-right.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/question-circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/save.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/search.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/seedling-circle.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/square.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/tools.svg +0 -0
- /package/src/components/{Icon → TsIcon}/icons/user.svg +0 -0
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.button {
|
|
1
|
+
.ts-button {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -9,74 +9,74 @@
|
|
|
9
9
|
cursor: pointer;
|
|
10
10
|
transition: all ease 0.3s;
|
|
11
11
|
}
|
|
12
|
-
.button > div {
|
|
12
|
+
.ts-button > div {
|
|
13
13
|
margin-right: 8px;
|
|
14
14
|
}
|
|
15
|
-
.button > div:last-child {
|
|
15
|
+
.ts-button > div:last-child {
|
|
16
16
|
margin-right: 0px;
|
|
17
17
|
}
|
|
18
18
|
/* ####### */
|
|
19
19
|
/* BLOCK */
|
|
20
|
-
.button--block {
|
|
20
|
+
.ts-button--block {
|
|
21
21
|
width: 100%;
|
|
22
22
|
}
|
|
23
23
|
/* ####### */
|
|
24
24
|
/* SIZES */
|
|
25
|
-
.button--md {
|
|
25
|
+
.ts-button--md {
|
|
26
26
|
height: 32px;
|
|
27
27
|
padding: 0 14px;
|
|
28
28
|
}
|
|
29
|
-
.button--md.button--icon-only {
|
|
29
|
+
.ts-button--md.ts-button--icon-only {
|
|
30
30
|
width: 32px;
|
|
31
31
|
padding: 0;
|
|
32
32
|
}
|
|
33
|
-
.button--lg {
|
|
33
|
+
.ts-button--lg {
|
|
34
34
|
height: 40px;
|
|
35
35
|
padding: 0 16px;
|
|
36
36
|
}
|
|
37
|
-
.button--lg.button--icon-only {
|
|
37
|
+
.ts-button--lg.ts-button--icon-only {
|
|
38
38
|
width: 40px;
|
|
39
39
|
padding: 0;
|
|
40
40
|
}
|
|
41
41
|
/* ########## */
|
|
42
42
|
/* VARIANTS */
|
|
43
|
-
.button--primary {
|
|
43
|
+
.ts-button--primary {
|
|
44
44
|
background: #3643ba;
|
|
45
45
|
color: #ffffff;
|
|
46
46
|
}
|
|
47
|
-
/* .button--primary:hover {
|
|
47
|
+
/* .ts-button--primary:hover {
|
|
48
48
|
background: #00689d;
|
|
49
49
|
} */
|
|
50
|
-
.button--secondary {
|
|
50
|
+
.ts-button--secondary {
|
|
51
51
|
background: #ebecf7;
|
|
52
52
|
color: #3643ba;
|
|
53
53
|
}
|
|
54
|
-
/* .button--secondary:hover {
|
|
54
|
+
/* .ts-button--secondary:hover {
|
|
55
55
|
background: #bedeef;
|
|
56
56
|
} */
|
|
57
|
-
.button--success {
|
|
57
|
+
.ts-button--success {
|
|
58
58
|
background: #02be8a;
|
|
59
59
|
color: #ffffff;
|
|
60
60
|
}
|
|
61
|
-
.button--success:hover {
|
|
61
|
+
.ts-button--success:hover {
|
|
62
62
|
background: #029e73;
|
|
63
63
|
color: #ffffff;
|
|
64
64
|
}
|
|
65
|
-
.button--ghost {
|
|
65
|
+
.ts-button--ghost {
|
|
66
66
|
background: #ffffff;
|
|
67
67
|
color: #1d1d1b;
|
|
68
68
|
}
|
|
69
|
-
.button--ghost:hover {
|
|
69
|
+
.ts-button--ghost:hover {
|
|
70
70
|
background: #ebecf7;
|
|
71
71
|
}
|
|
72
|
-
.button--shadow {
|
|
72
|
+
.ts-button--shadow {
|
|
73
73
|
box-shadow: 0px 12px 12px 0px #00537d1a;
|
|
74
74
|
background: #ffffff;
|
|
75
75
|
color: #4e5d6b;
|
|
76
76
|
}
|
|
77
77
|
/* ######### */
|
|
78
78
|
/* ROUNDED */
|
|
79
|
-
.button--rounded {
|
|
79
|
+
.ts-button--rounded {
|
|
80
80
|
border-radius: 9999px;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { TsIcon } from '../TsIcon/TsIcon';
|
|
4
|
+
import { TsButtonProps } from './TsButton.types';
|
|
5
|
+
import './TsButton.css';
|
|
6
|
+
|
|
7
|
+
export const TsButton = ({
|
|
8
|
+
children,
|
|
9
|
+
icon,
|
|
10
|
+
iconDirection = 'left',
|
|
11
|
+
size = 'md',
|
|
12
|
+
variant = 'primary',
|
|
13
|
+
block,
|
|
14
|
+
rounded,
|
|
15
|
+
onClick,
|
|
16
|
+
}: PropsWithChildren<TsButtonProps>) => {
|
|
17
|
+
// #########
|
|
18
|
+
// Rendering
|
|
19
|
+
return (
|
|
20
|
+
<button
|
|
21
|
+
className={`
|
|
22
|
+
ts-button ts-button--${size} ts-button--${variant}
|
|
23
|
+
${block ? 'ts-button--block' : ''}
|
|
24
|
+
${rounded ? 'ts-button--rounded' : ''}
|
|
25
|
+
${icon && !children ? 'ts-button--icon-only' : ''}
|
|
26
|
+
`}
|
|
27
|
+
onClick={onClick}
|
|
28
|
+
>
|
|
29
|
+
{icon && iconDirection === 'left' && <TsIcon name={icon} size="16" />}
|
|
30
|
+
{children && <div>{children}</div>}
|
|
31
|
+
{icon && iconDirection === 'right' && <TsIcon name={icon} size="16" />}
|
|
32
|
+
</button>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
-
import {
|
|
4
|
-
import { icons } from '../../
|
|
3
|
+
import { TsButton } from '../TsButton';
|
|
4
|
+
import { icons } from '../../TsIcon/icons';
|
|
5
5
|
|
|
6
6
|
<Meta title="Components/Button" />
|
|
7
7
|
|
|
@@ -65,10 +65,10 @@ Buttons express what action will occur when the users clicks. Buttons are used t
|
|
|
65
65
|
}}
|
|
66
66
|
argTypes={buttonArgTypes}
|
|
67
67
|
>
|
|
68
|
-
{args => <
|
|
68
|
+
{args => <TsButton {...args}>{args.children}</TsButton>}
|
|
69
69
|
</Story>
|
|
70
70
|
</Canvas>
|
|
71
71
|
|
|
72
72
|
## Props
|
|
73
73
|
|
|
74
|
-
<ArgsTable story="Overview" of={
|
|
74
|
+
<ArgsTable story="Overview" of={TsButton} />
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
.icon--16 {
|
|
1
|
+
.ts-icon--16 {
|
|
2
2
|
width: 16px;
|
|
3
3
|
height: 16px;
|
|
4
4
|
}
|
|
5
|
-
.icon--20 {
|
|
5
|
+
.ts-icon--20 {
|
|
6
6
|
width: 20px;
|
|
7
7
|
height: 20px;
|
|
8
8
|
}
|
|
9
|
-
.icon--24 {
|
|
9
|
+
.ts-icon--24 {
|
|
10
10
|
width: 24px;
|
|
11
11
|
height: 24px;
|
|
12
12
|
}
|
|
13
|
-
.icon svg {
|
|
13
|
+
.ts-icon svg {
|
|
14
14
|
width: 100%;
|
|
15
15
|
height: 100%;
|
|
16
16
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsIconProps } from './TsIcon.types';
|
|
3
|
+
import { icons } from './icons';
|
|
4
|
+
import './TsIcon.css';
|
|
5
|
+
|
|
6
|
+
export const TsIcon = ({ name, size = '20' }: TsIconProps) => {
|
|
7
|
+
const icon = icons[name];
|
|
8
|
+
|
|
9
|
+
// #########
|
|
10
|
+
// Rendering
|
|
11
|
+
if (!icon) return <></>;
|
|
12
|
+
return <div className={`ts-icon ts-icon--${size}`} dangerouslySetInnerHTML={{ __html: icon }} />;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TsIconProps = { name: string; size?: '16' | '20' | '24' };
|
package/src/components/{Icon/__stories__/Icon.stories.mdx → TsIcon/__stories__/TsIcon.stories.mdx}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
-
import {
|
|
3
|
+
import { TsIcon } from '../TsIcon';
|
|
4
4
|
import { icons } from '../icons';
|
|
5
5
|
|
|
6
6
|
<Meta title="Guidelines/Iconography" />
|
|
@@ -65,13 +65,13 @@ Icons are visual symbols used to represent ideas, objects or actions. They commu
|
|
|
65
65
|
|
|
66
66
|
<Canvas>
|
|
67
67
|
<Story name="Overview" args={{ name: 'heart', size: '20' }} argTypes={iconArgTypes}>
|
|
68
|
-
{args => <
|
|
68
|
+
{args => <TsIcon {...args} />}
|
|
69
69
|
</Story>
|
|
70
70
|
</Canvas>
|
|
71
71
|
|
|
72
72
|
## Props
|
|
73
73
|
|
|
74
|
-
<ArgsTable story="Overview" of={
|
|
74
|
+
<ArgsTable story="Overview" of={TsIcon} />
|
|
75
75
|
|
|
76
76
|
## Icons
|
|
77
77
|
|
|
@@ -81,7 +81,7 @@ Icons are visual symbols used to represent ideas, objects or actions. They commu
|
|
|
81
81
|
.map(icon => (
|
|
82
82
|
<div className="icon-container" key={icon}>
|
|
83
83
|
<div className="icon">
|
|
84
|
-
<
|
|
84
|
+
<TsIcon name={icon} />
|
|
85
85
|
</div>
|
|
86
86
|
<div className="icon-label">{icon}</div>
|
|
87
87
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.loader {
|
|
10
|
+
.ts-loader {
|
|
11
11
|
border: 2px solid;
|
|
12
12
|
border-color: #3643ba transparent;
|
|
13
13
|
border-radius: 50%;
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
|
|
19
19
|
/* ####### */
|
|
20
20
|
/* SIZES */
|
|
21
|
-
.loader--sm {
|
|
21
|
+
.ts-loader--sm {
|
|
22
22
|
width: 24px;
|
|
23
23
|
height: 24px;
|
|
24
24
|
}
|
|
25
|
-
.loader--md {
|
|
25
|
+
.ts-loader--md {
|
|
26
26
|
width: 32px;
|
|
27
27
|
height: 32px;
|
|
28
28
|
}
|
|
29
|
-
.loader--lg {
|
|
29
|
+
.ts-loader--lg {
|
|
30
30
|
width: 44px;
|
|
31
31
|
height: 44px;
|
|
32
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TsLoaderProps = { size?: 'sm' | 'md' | 'lg' };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
-
import {
|
|
3
|
+
import { TsLoader } from '../TsLoader';
|
|
4
4
|
|
|
5
5
|
<Meta title="Components/Loader" />
|
|
6
6
|
|
|
@@ -21,10 +21,10 @@ Loader express to user that an action is occuring.
|
|
|
21
21
|
|
|
22
22
|
<Canvas>
|
|
23
23
|
<Story name="Overview" args={{ size: 'md' }} argTypes={loaderArgTypes}>
|
|
24
|
-
{args => <
|
|
24
|
+
{args => <TsLoader {...args}>{args.children}</TsLoader>}
|
|
25
25
|
</Story>
|
|
26
26
|
</Canvas>
|
|
27
27
|
|
|
28
28
|
## Props
|
|
29
29
|
|
|
30
|
-
<ArgsTable story="Overview" of={
|
|
30
|
+
<ArgsTable story="Overview" of={TsLoader} />
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
export * from './components/
|
|
2
|
-
export * from './components/
|
|
3
|
-
export * from './components/
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './components/Select/Select';
|
|
8
|
-
export * from './layouts/Header/Header';
|
|
9
|
-
export * from './layouts/Header/HeaderProfile';
|
|
10
|
-
export * from './layouts/Header/HeaderSearch';
|
|
11
|
-
export * from './layouts/Navigation/Navigation';
|
|
1
|
+
export * from './components/TsButton/TsButton';
|
|
2
|
+
export * from './components/TsIcon/TsIcon';
|
|
3
|
+
export * from './components/TsLoader/TsLoader';
|
|
4
|
+
export * from './layouts/TsHeader/TsHeader';
|
|
5
|
+
export * from './layouts/TsHeader/TsHeaderProfile';
|
|
6
|
+
export * from './layouts/TsNavigation/TsNavigation';
|
|
@@ -17,31 +17,31 @@ header {
|
|
|
17
17
|
height: 64px;
|
|
18
18
|
padding: 0 24px;
|
|
19
19
|
}
|
|
20
|
-
.header-aside {
|
|
20
|
+
.ts-header-aside {
|
|
21
21
|
display: flex;
|
|
22
22
|
align-items: center;
|
|
23
23
|
flex: 1;
|
|
24
24
|
height: 100%;
|
|
25
25
|
}
|
|
26
|
-
.header-right-side {
|
|
26
|
+
.ts-header-right-side {
|
|
27
27
|
justify-content: flex-end;
|
|
28
28
|
}
|
|
29
|
-
.header-search-bar {
|
|
29
|
+
.ts-header-search-bar {
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
32
32
|
width: 400px;
|
|
33
33
|
height: 100%;
|
|
34
34
|
}
|
|
35
|
-
.header-actions {
|
|
35
|
+
.ts-header-actions {
|
|
36
36
|
display: flex;
|
|
37
37
|
}
|
|
38
|
-
.header-actions > * {
|
|
38
|
+
.ts-header-actions > * {
|
|
39
39
|
margin-left: 12px;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/* ################ */
|
|
43
43
|
/* HEADER TECHOFF */
|
|
44
|
-
.header-techoff {
|
|
44
|
+
.ts-header-techoff {
|
|
45
45
|
display: flex;
|
|
46
46
|
height: 18px;
|
|
47
47
|
margin-left: 4px;
|
|
@@ -49,10 +49,10 @@ header {
|
|
|
49
49
|
|
|
50
50
|
/* ################ */
|
|
51
51
|
/* HEADER PROFILE */
|
|
52
|
-
.header-profile-container {
|
|
52
|
+
.ts-header-profile-container {
|
|
53
53
|
position: relative;
|
|
54
54
|
}
|
|
55
|
-
.header-profile-dropdown {
|
|
55
|
+
.ts-header-profile-dropdown {
|
|
56
56
|
display: flex;
|
|
57
57
|
height: 40px;
|
|
58
58
|
border-radius: 9999px;
|
|
@@ -61,13 +61,13 @@ header {
|
|
|
61
61
|
background-color: #ffffff;
|
|
62
62
|
cursor: pointer;
|
|
63
63
|
}
|
|
64
|
-
.header-profile-img-container {
|
|
64
|
+
.ts-header-profile-img-container {
|
|
65
65
|
width: 40px;
|
|
66
66
|
height: 40px;
|
|
67
67
|
padding: 4px;
|
|
68
68
|
border-radius: 9999px;
|
|
69
69
|
}
|
|
70
|
-
.header-profile-img-icon {
|
|
70
|
+
.ts-header-profile-img-icon {
|
|
71
71
|
display: flex;
|
|
72
72
|
align-items: center;
|
|
73
73
|
justify-content: center;
|
|
@@ -76,14 +76,14 @@ header {
|
|
|
76
76
|
border-radius: 9999px;
|
|
77
77
|
background-color: rgb(229, 229, 229);
|
|
78
78
|
}
|
|
79
|
-
.header-profile-name {
|
|
79
|
+
.ts-header-profile-name {
|
|
80
80
|
display: flex;
|
|
81
81
|
flex: 1;
|
|
82
82
|
align-items: center;
|
|
83
83
|
padding-left: 4px;
|
|
84
84
|
padding-right: 16px;
|
|
85
85
|
}
|
|
86
|
-
.header-profile-chevron {
|
|
86
|
+
.ts-header-profile-chevron {
|
|
87
87
|
display: flex;
|
|
88
88
|
align-items: center;
|
|
89
89
|
justify-content: center;
|
|
@@ -91,7 +91,7 @@ header {
|
|
|
91
91
|
padding-right: 14px;
|
|
92
92
|
border-radius: 9999px;
|
|
93
93
|
}
|
|
94
|
-
.header-profile-menu {
|
|
94
|
+
.ts-header-profile-menu {
|
|
95
95
|
position: absolute;
|
|
96
96
|
right: 0;
|
|
97
97
|
top: 48px;
|
|
@@ -102,35 +102,35 @@ header {
|
|
|
102
102
|
background-color: #ffffff;
|
|
103
103
|
z-index: 10;
|
|
104
104
|
}
|
|
105
|
-
.header-profile-menu-item {
|
|
105
|
+
.ts-header-profile-menu-item {
|
|
106
106
|
display: flex;
|
|
107
107
|
align-items: center;
|
|
108
108
|
height: 36px;
|
|
109
109
|
border-radius: 6px;
|
|
110
110
|
cursor: pointer;
|
|
111
111
|
}
|
|
112
|
-
.header-profile-menu-item:hover {
|
|
112
|
+
.ts-header-profile-menu-item:hover {
|
|
113
113
|
background-color: #e7f3f9;
|
|
114
114
|
}
|
|
115
|
-
.header-profile-menu-item-icon {
|
|
115
|
+
.ts-header-profile-menu-item-icon {
|
|
116
116
|
display: flex;
|
|
117
117
|
align-items: center;
|
|
118
118
|
justify-content: center;
|
|
119
119
|
width: 36px;
|
|
120
120
|
height: 36px;
|
|
121
121
|
}
|
|
122
|
-
.header-profile-menu-item-label {
|
|
122
|
+
.ts-header-profile-menu-item-label {
|
|
123
123
|
flex: 1;
|
|
124
124
|
padding: 0 2px;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/* ############### */
|
|
128
128
|
/* HEADER SEARCH */
|
|
129
|
-
.header-search {
|
|
129
|
+
.ts-header-search {
|
|
130
130
|
position: relative;
|
|
131
131
|
width: 100%;
|
|
132
132
|
}
|
|
133
|
-
.header-search-items-container {
|
|
133
|
+
.ts-header-search-items-container {
|
|
134
134
|
position: absolute;
|
|
135
135
|
top: calc(100% + 4px);
|
|
136
136
|
width: 100%;
|
|
@@ -141,13 +141,13 @@ header {
|
|
|
141
141
|
overflow-y: auto;
|
|
142
142
|
z-index: 100;
|
|
143
143
|
}
|
|
144
|
-
.header-search-loading {
|
|
144
|
+
.ts-header-search-loading {
|
|
145
145
|
display: flex;
|
|
146
146
|
align-items: center;
|
|
147
147
|
justify-content: center;
|
|
148
148
|
height: 40px;
|
|
149
149
|
}
|
|
150
|
-
.header-search-no-items {
|
|
150
|
+
.ts-header-search-no-items {
|
|
151
151
|
display: flex;
|
|
152
152
|
align-items: center;
|
|
153
153
|
justify-content: center;
|
|
@@ -155,10 +155,10 @@ header {
|
|
|
155
155
|
color: #8c96a2;
|
|
156
156
|
font-style: italic;
|
|
157
157
|
}
|
|
158
|
-
.header-search-items {
|
|
158
|
+
.ts-header-search-items {
|
|
159
159
|
padding: 8px;
|
|
160
160
|
}
|
|
161
|
-
.header-search-item {
|
|
161
|
+
.ts-header-search-item {
|
|
162
162
|
display: flex;
|
|
163
163
|
align-items: center;
|
|
164
164
|
height: 32px;
|
|
@@ -166,10 +166,10 @@ header {
|
|
|
166
166
|
border-radius: 4px;
|
|
167
167
|
cursor: pointer;
|
|
168
168
|
}
|
|
169
|
-
.header-search-item:hover {
|
|
169
|
+
.ts-header-search-item:hover {
|
|
170
170
|
background: #e7f3f9;
|
|
171
171
|
}
|
|
172
|
-
.header-search-item--match {
|
|
172
|
+
.ts-header-search-item--match {
|
|
173
173
|
background: #cce5f2;
|
|
174
174
|
color: #007dbc;
|
|
175
175
|
font-weight: 700;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { icons } from '../../components/TsIcon/icons';
|
|
3
|
+
import { TsHeaderProps } from './TsHeader.types';
|
|
4
|
+
import './TsHeader.css';
|
|
5
|
+
|
|
6
|
+
export const TsHeader = ({ actions, appName }: TsHeaderProps) => {
|
|
7
|
+
// #########
|
|
8
|
+
// Rendering
|
|
9
|
+
return (
|
|
10
|
+
<header>
|
|
11
|
+
<div className="ts-header-aside">
|
|
12
|
+
<div className="ts-header-techoff" dangerouslySetInnerHTML={{ __html: icons[`header-${appName}`] }} />
|
|
13
|
+
</div>
|
|
14
|
+
{/* {search && <div className="header-search-bar">{search}</div>} */}
|
|
15
|
+
<div className="ts-header-aside ts-header-right-side">
|
|
16
|
+
<div className="ts-header-actions">{actions}</div>
|
|
17
|
+
</div>
|
|
18
|
+
</header>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type TsHeaderProps = {
|
|
4
4
|
actions: ReactElement;
|
|
5
5
|
appName: 'bikestudio' | 'nsc-helmet' | 'opticost' | 'repairability';
|
|
6
6
|
search?: ReactElement;
|
|
7
7
|
};
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
8
|
+
export type TsHeaderProfileItemProps = { icon: string; label: string; link: string };
|
|
9
|
+
export type TsHeaderProfileProps = { firstname: string; lastname: string };
|
|
10
|
+
export type TsHeaderSearchProps = {
|
|
11
11
|
getItemLabel: (e: any) => string;
|
|
12
12
|
getItemValue: (e: any) => string;
|
|
13
13
|
loadItems: (search?: string) => Promise<any[]>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren, useState } from 'react';
|
|
3
|
+
import { TsIcon } from '../../components/TsIcon/TsIcon';
|
|
4
|
+
import { useClickOutside } from '../../hooks/use-click-outside';
|
|
5
|
+
import { capitalize } from '../../utils/string.utils';
|
|
6
|
+
import { TsHeaderProfileItemProps, TsHeaderProfileProps } from './TsHeader.types';
|
|
7
|
+
|
|
8
|
+
export const TsHeaderProfileItem = ({ icon, label, link }: TsHeaderProfileItemProps) => {
|
|
9
|
+
// ########
|
|
10
|
+
// Handlers
|
|
11
|
+
const handleNavigate = () => window.open(link, '_blank', 'noreferrer');
|
|
12
|
+
|
|
13
|
+
// #########
|
|
14
|
+
// Rendering
|
|
15
|
+
return (
|
|
16
|
+
<div className="ts-header-profile-menu-item" onClick={handleNavigate}>
|
|
17
|
+
<div className="ts-header-profile-menu-item-icon">
|
|
18
|
+
<TsIcon name={icon} size="16" />
|
|
19
|
+
</div>
|
|
20
|
+
<div className="ts-header-profile-menu-item-label">{label}</div>
|
|
21
|
+
<div className="ts-header-profile-menu-item-icon">
|
|
22
|
+
<TsIcon name="external-link" size="16" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const TsHeaderProfile = ({ children, firstname, lastname }: TsHeaderProfileProps & PropsWithChildren) => {
|
|
29
|
+
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
30
|
+
const ref = useClickOutside(() => setIsOpen(false));
|
|
31
|
+
|
|
32
|
+
// #########
|
|
33
|
+
// Rendering
|
|
34
|
+
return (
|
|
35
|
+
<div className="ts-header-profile-container" ref={ref}>
|
|
36
|
+
<div className="ts-header-profile-dropdown" onClick={() => children && setIsOpen(prev => !prev)}>
|
|
37
|
+
<div className="ts-header-profile-img-container">
|
|
38
|
+
<div className="ts-header-profile-img-icon">
|
|
39
|
+
<TsIcon name="user" size="16" />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div className="ts-header-profile-name">
|
|
43
|
+
{capitalize(firstname)} {lastname.charAt(0).toUpperCase()}.
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
{children && (
|
|
47
|
+
<div className="ts-header-profile-chevron">
|
|
48
|
+
<TsIcon name={isOpen ? 'chevron-up' : 'chevron-down'} size="16" />
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
{isOpen && <div className="ts-header-profile-menu">{children}</div>}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
// import { Input } from '../../components/Inputs/Input/Input';
|
|
4
|
-
import {
|
|
4
|
+
import { TsLoader } from '../../components/TsLoader/TsLoader';
|
|
5
5
|
import { useClickOutside } from '../../hooks/use-click-outside';
|
|
6
|
-
import {
|
|
6
|
+
import { TsHeaderSearchProps } from './TsHeader.types';
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const TsHeaderSearch = ({
|
|
9
9
|
getItemLabel,
|
|
10
10
|
getItemValue,
|
|
11
11
|
loadItems,
|
|
12
12
|
noDataLabel,
|
|
13
13
|
placeholder,
|
|
14
14
|
onChange,
|
|
15
|
-
}:
|
|
15
|
+
}: TsHeaderSearchProps) => {
|
|
16
16
|
const [searchValue, setSearchValue] = useState<string>('');
|
|
17
17
|
const [items, setItems] = useState<any[]>([]);
|
|
18
18
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
@@ -58,7 +58,7 @@ export const HeaderSearch = ({
|
|
|
58
58
|
// #########
|
|
59
59
|
// Rendering
|
|
60
60
|
return (
|
|
61
|
-
<div className="header-search" ref={ref}>
|
|
61
|
+
<div className="ts-header-search" ref={ref}>
|
|
62
62
|
{/* <Input
|
|
63
63
|
placeholder={placeholder}
|
|
64
64
|
icon="search"
|
|
@@ -72,19 +72,19 @@ export const HeaderSearch = ({
|
|
|
72
72
|
/> */}
|
|
73
73
|
|
|
74
74
|
{showItems && searchValue !== '' && (
|
|
75
|
-
<div className="header-search-items-container">
|
|
75
|
+
<div className="ts-header-search-items-container">
|
|
76
76
|
{isLoading && (
|
|
77
|
-
<div className="header-search-loading">
|
|
78
|
-
<
|
|
77
|
+
<div className="ts-header-search-loading">
|
|
78
|
+
<TsLoader size="sm" />
|
|
79
79
|
</div>
|
|
80
80
|
)}
|
|
81
|
-
{!isLoading && items.length === 0 && <div className="header-search-no-items">{noDataLabel}</div>}
|
|
81
|
+
{!isLoading && items.length === 0 && <div className="ts-header-search-no-items">{noDataLabel}</div>}
|
|
82
82
|
{!isLoading && items.length > 0 && (
|
|
83
|
-
<div className="header-search-items">
|
|
83
|
+
<div className="ts-header-search-items">
|
|
84
84
|
{items.map(item => (
|
|
85
|
-
<div className="header-search-item" onClick={() => onChange(getItemValue(item))}>
|
|
85
|
+
<div className="ts-header-search-item" onClick={() => onChange(getItemValue(item))}>
|
|
86
86
|
{getBeforeMatch(item)}
|
|
87
|
-
<span className="header-search-item--match">{getMatch(item)}</span>
|
|
87
|
+
<span className="ts-header-search-item--match">{getMatch(item)}</span>
|
|
88
88
|
{getAfterMatch(item)}
|
|
89
89
|
</div>
|
|
90
90
|
))}
|