@omniumretail/component-library 1.1.11 → 1.1.13
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/dist/bundle.js +1 -1
- package/dist/main.css +1 -1
- package/dist/types/components/DropdownButton/DropdownButton.stories.d.ts +4 -0
- package/dist/types/components/DropdownButton/index.d.ts +10 -0
- package/dist/types/components/Navigation/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/DropdownButton/DropdownButton.stories.tsx +15 -0
- package/src/components/DropdownButton/index.tsx +35 -0
- package/src/components/Navigation/Navigation.stories.tsx +2 -1
- package/src/components/Navigation/index.tsx +21 -3
- package/src/components/Navigation/styles.module.scss +19 -4
- package/src/components/index.tsx +2 -1
package/dist/main.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.lCPh1mJwiXUUOgmbv_mk{padding:12px 24px;border-radius:4px;min-width:170px;display:inline-flex;align-items:center;justify-content:center;align-self:flex-start;text-decoration:none;border:none;font-size:14px;line-height:16.8px;font-weight:700;font-family:"Silka",sans-serif;background-color:var(--button-default-background);color:var(--button-default-text-color)}@media(max-width: 767px){.lCPh1mJwiXUUOgmbv_mk{min-width:0px}}.lCPh1mJwiXUUOgmbv_mk:hover{background-color:var(--button-default-background-hover-color);color:var(--button-default-text-hover-color) !important}.lCPh1mJwiXUUOgmbv_mk:focus,.lCPh1mJwiXUUOgmbv_mk:active,.lCPh1mJwiXUUOgmbv_mk:focus:active{background-color:var(--button-default-background-focus-color);color:var(--button-default-text-focus-color)}.lCPh1mJwiXUUOgmbv_mk:disabled,.lCPh1mJwiXUUOgmbv_mk.vwrGv_jOJcIvImjzKZNv{background-color:var(--button-disabled-background-color);color:var(--button-disabled-default-text-color);pointer-events:none}.PYUelyvKNnKRxaBMgCyk{flex-direction:row-reverse;gap:5px}.edzSVcT9ajLWxd6QfVI1{background-color:var(--button-style-1-background);color:var(--button-style-1-text-color)}.edzSVcT9ajLWxd6QfVI1:hover{background-color:var(--button-style-1-background-hover-color);color:var(--button-style-1-text-hover-color) !important}.edzSVcT9ajLWxd6QfVI1:focus,.edzSVcT9ajLWxd6QfVI1:active,.edzSVcT9ajLWxd6QfVI1:focus:active{background-color:var(--button-style-1-background-focus-color);color:var(--button-style-1-text-focus-color)}.edzSVcT9ajLWxd6QfVI1:disabled,.edzSVcT9ajLWxd6QfVI1.vwrGv_jOJcIvImjzKZNv{background-color:var(--button-disabled-background-color);color:var(--button-disabled-default-text-color);pointer-events:none}
|
|
2
|
-
.UxfXOleP69PjM5rFOMTD{display:grid !important;grid-template-columns:repeat(3, 1fr) !important;justify-items:center !important;align-items:center !important;height:75px !important;gap:0 24px !important;position:relative !important;padding:0px !important}@media(max-width: 767px){.UxfXOleP69PjM5rFOMTD .UxfXOleP69PjM5rFOMTD{grid-template-columns:1fr}.UxfXOleP69PjM5rFOMTD .UK3esJZjnri5Jb9Jxcca,.UxfXOleP69PjM5rFOMTD .U5tZ7kRlrIHUKsuduD1S{justify-self:center}.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{text-align:center}.UxfXOleP69PjM5rFOMTD .DhO9jcXNunsWq22jXuJJ{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{font-size:var(--font-size-body-3);font-weight:var(--font-weight-semibold);text-transform:uppercase}@media(min-width: 768px){.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{font-size:var(--font-size-body-4)}}.UxfXOleP69PjM5rFOMTD .gn06XRZhFG00HaVjAqNc{align-self:center}@media(max-width: 768px){.UxfXOleP69PjM5rFOMTD .gn06XRZhFG00HaVjAqNc{position:unset !important;top:unset !important;margin:unset !important;left:unset !important;right:unset !important;text-align:unset !important}}.UxfXOleP69PjM5rFOMTD .UK3esJZjnri5Jb9Jxcca{justify-self:start}.UxfXOleP69PjM5rFOMTD .
|
|
2
|
+
.UxfXOleP69PjM5rFOMTD{display:grid !important;grid-template-columns:repeat(3, 1fr) !important;justify-items:center !important;align-items:center !important;height:75px !important;gap:0 24px !important;position:relative !important;padding:0px !important}@media(max-width: 767px){.UxfXOleP69PjM5rFOMTD .UxfXOleP69PjM5rFOMTD{grid-template-columns:1fr}.UxfXOleP69PjM5rFOMTD .UK3esJZjnri5Jb9Jxcca,.UxfXOleP69PjM5rFOMTD .U5tZ7kRlrIHUKsuduD1S{justify-self:center}.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{text-align:center}.UxfXOleP69PjM5rFOMTD .DhO9jcXNunsWq22jXuJJ{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{font-size:var(--font-size-body-3);font-weight:var(--font-weight-semibold);text-transform:uppercase}@media(min-width: 768px){.UxfXOleP69PjM5rFOMTD .LzcTbjk0fp70tXlKd3eS{font-size:var(--font-size-body-4)}}.UxfXOleP69PjM5rFOMTD .gn06XRZhFG00HaVjAqNc{align-self:center}@media(max-width: 768px){.UxfXOleP69PjM5rFOMTD .gn06XRZhFG00HaVjAqNc{position:unset !important;top:unset !important;margin:unset !important;left:unset !important;right:unset !important;text-align:unset !important}}.UxfXOleP69PjM5rFOMTD .UK3esJZjnri5Jb9Jxcca{justify-self:start}.UxfXOleP69PjM5rFOMTD .SP4eLTEZBzKjo_LdsNw2{justify-self:end}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .SP4eLTEZBzKjo_LdsNw2{width:80px}}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .SP4eLTEZBzKjo_LdsNw2 :where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only{padding-inline-start:40px}}.UxfXOleP69PjM5rFOMTD .nt_yaN_SHYobZ6zexnfY{justify-self:end}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .nt_yaN_SHYobZ6zexnfY{width:60px}}@media(max-width: 460px){.UxfXOleP69PjM5rFOMTD .nt_yaN_SHYobZ6zexnfY :where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only{padding-inline-start:22px}}
|
|
3
3
|
.ii1Ag3GTfp8unGCe48A0{display:inline-flex;text-decoration:none;height:auto;color:var(--color-black);font-size:var(--font-size-body-3);line-height:100%;font-weight:300;font-style:var(--font-style-italic)}.L9ncGwaItcjHJBLuwrKb{color:var(--color-orange);font-style:var(--font-style-normal)}.Yrb4eAglcF7FedoEB9AH span:nth-child(2){margin-inline-end:8px;margin-inline-start:0;order:-1}
|
|
4
4
|
.GhX1oPovx60SBqLAcIRO{border-color:rgba(var(--color-black-rgb), 0.5);height:50px;font-size:var(--font-size-body-3);line-height:100%;color:var(--color-black);border-radius:5px}
|
|
5
5
|
._ox_QPqUHev1INeaUhs7 .ant-select-selector{border-color:rgba(var(--color-black-rgb), 0.5) !important;height:50px !important;display:flex;align-items:center}._ox_QPqUHev1INeaUhs7 .ant-select-arrow{color:var(--color-black)}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownProps } from 'antd';
|
|
3
|
+
interface DropdownButtonProps extends DropdownProps {
|
|
4
|
+
options: string[];
|
|
5
|
+
buttonText: string;
|
|
6
|
+
buttonClass?: string;
|
|
7
|
+
customButton?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const DropdownButton: ({ options, buttonText, buttonClass, customButton, ...props }: DropdownButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -7,5 +7,6 @@ export interface NavigationProps {
|
|
|
7
7
|
loginOnClickFunction?: () => void;
|
|
8
8
|
backLinkOnClickFunction?: () => void;
|
|
9
9
|
homeOnClickFunction?: () => void;
|
|
10
|
+
options?: string[];
|
|
10
11
|
}
|
|
11
12
|
export declare const Navigation: (props: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, Story } from '@storybook/react';
|
|
3
|
+
import { DropdownButton } from './index';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'DropdownButton',
|
|
7
|
+
component: DropdownButton,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<any> = (args) => <DropdownButton {...args} />;
|
|
11
|
+
|
|
12
|
+
export const BasicDropdown = Template.bind({});
|
|
13
|
+
BasicDropdown.args = {
|
|
14
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Menu, Dropdown, DropdownProps } from 'antd';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
|
|
6
|
+
interface DropdownButtonProps extends DropdownProps {
|
|
7
|
+
options: string[];
|
|
8
|
+
buttonText: string;
|
|
9
|
+
buttonClass?: string;
|
|
10
|
+
customButton?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DropdownButton = ({ options, buttonText, buttonClass, customButton, ...props }: DropdownButtonProps) => {
|
|
14
|
+
const menu = (
|
|
15
|
+
<Menu>
|
|
16
|
+
{options.map((option, index) => (
|
|
17
|
+
<Menu.Item key={index}>{option}</Menu.Item>
|
|
18
|
+
))}
|
|
19
|
+
</Menu>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const linkClasses = classNames({
|
|
23
|
+
[`${buttonClass}`]: buttonClass,
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Dropdown overlay={menu} trigger={['click']}>
|
|
28
|
+
{customButton ? (
|
|
29
|
+
customButton
|
|
30
|
+
) : (
|
|
31
|
+
<Button className={linkClasses}>{buttonText}</Button>
|
|
32
|
+
)}
|
|
33
|
+
</Dropdown>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styles from './styles.module.scss';
|
|
2
2
|
import { Link } from '../Link';
|
|
3
|
+
import { DropdownButton } from '../DropdownButton';
|
|
3
4
|
import { ArrowLeftOutlined, HomeOutlined, LogoutOutlined, UserOutlined } from '@ant-design/icons';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
6
|
import { useEffect, useState } from 'react';
|
|
@@ -13,6 +14,7 @@ export interface NavigationProps {
|
|
|
13
14
|
loginOnClickFunction?: () => void;
|
|
14
15
|
backLinkOnClickFunction?: () => void;
|
|
15
16
|
homeOnClickFunction?: () => void;
|
|
17
|
+
options?: string[];
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
const TABLET_MAX_WIDTH = 1000;
|
|
@@ -22,6 +24,7 @@ export const Navigation = (props: NavigationProps) => {
|
|
|
22
24
|
const { t } = useTranslation();
|
|
23
25
|
|
|
24
26
|
const [isTablet, setIsTablet] = useState(false);
|
|
27
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
25
28
|
|
|
26
29
|
const checkMediaQuery = () => {
|
|
27
30
|
const isPhoneWidth = window.innerWidth < TABLET_MAX_WIDTH;
|
|
@@ -63,9 +66,24 @@ export const Navigation = (props: NavigationProps) => {
|
|
|
63
66
|
<div className={styles.columnCenter}>
|
|
64
67
|
<h1 className={`${styles.title} ${styles.titleMobile}`}>{title}</h1>
|
|
65
68
|
</div>
|
|
66
|
-
<div className={styles.
|
|
67
|
-
{userName &&
|
|
68
|
-
|
|
69
|
+
<div className={`${userName ? styles.columnRightWithUser : styles.columnRightWithNoUser}`}>
|
|
70
|
+
{userName && (
|
|
71
|
+
<DropdownButton
|
|
72
|
+
options={props.options!}
|
|
73
|
+
buttonText={props.userName!}
|
|
74
|
+
customButton={(
|
|
75
|
+
<Link
|
|
76
|
+
icon={<UserOutlined />}
|
|
77
|
+
linkSecondary
|
|
78
|
+
iconAlignRight
|
|
79
|
+
onClick={() => setShowDropdown(!showDropdown)}
|
|
80
|
+
>
|
|
81
|
+
{getInitials(userName)}
|
|
82
|
+
</Link>
|
|
83
|
+
)}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
{homeLink && <Link icon={<HomeOutlined />} linkSecondary iconAlignRight onClick={homeOnClickFunction}> {!isTablet && t('navigation.home')} </Link>}
|
|
69
87
|
{loginLink && <Link href="#" onClick={loginOnClickFunction} icon={<LogoutOutlined />} linkSecondary iconAlignRight>{!isTablet && t('navigation.logout')}</Link>}
|
|
70
88
|
</div>
|
|
71
89
|
</div>
|
|
@@ -57,19 +57,34 @@
|
|
|
57
57
|
justify-self: start;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.
|
|
60
|
+
.columnRightWithUser {
|
|
61
61
|
justify-self: end;
|
|
62
62
|
|
|
63
63
|
@media(max-width: 460px) {
|
|
64
64
|
width: 80px;
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
:global {
|
|
68
|
+
@media(max-width: 460px) {
|
|
69
|
+
:where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only {
|
|
70
|
+
padding-inline-start: 40px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
.columnRightWithNoUser {
|
|
77
|
+
justify-self: end;
|
|
78
|
+
|
|
69
79
|
@media(max-width: 460px) {
|
|
80
|
+
width: 60px;
|
|
81
|
+
}
|
|
70
82
|
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
:global {
|
|
84
|
+
@media(max-width: 460px) {
|
|
85
|
+
:where(.css-dev-only-do-not-override-fpg3f5).ant-btn.ant-btn-icon-only {
|
|
86
|
+
padding-inline-start: 22px;
|
|
87
|
+
}
|
|
73
88
|
}
|
|
74
89
|
}
|
|
75
90
|
}
|
package/src/components/index.tsx
CHANGED