@vtex/faststore-plugin-buyer-portal 1.0.2 → 1.0.3
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 +4 -3
- package/src/components/CustomerSwitch/CustomerSwitchDrawer.tsx +10 -16
- package/src/components/Icons/Link.tsx +17 -0
- package/src/components/{CustomerSwitch/CustomerSwitchLoad.tsx → Icons/Load.tsx} +4 -7
- package/src/components/Icons/Profile.tsx +15 -0
- package/src/components/Icons/index.ts +8 -0
- package/src/components/Logo/Logo.tsx +18 -0
- package/src/components/Navbar/Navbar.tsx +37 -0
- package/src/components/Navbar/navbar.scss +50 -0
- package/src/components/ProfileSummary/ProfileSummary.tsx +49 -0
- package/src/components/ProfileSummary/profile-summary.scss +73 -0
- package/src/components/SelfManagementDrawer/SelfManagementDrawer.tsx +9 -8
- package/src/components/SelfManagementDrawer/SelfManagementDrawerHeader.tsx +5 -30
- package/src/components/SelfManagementDrawer/index.ts +0 -1
- package/src/components/SelfManagementDrawer/self-management-drawer.scss +86 -0
- package/src/components/SelfManagementSignInButton/SelfManagementSignInButton.tsx +3 -2
- package/src/mock/profile-data.ts +7 -0
- package/src/pages/buyer-portal.tsx +3 -1
- package/src/themes/index.scss +6 -174
- package/tsconfig.json +1 -1
- package/src/components/SelfManagementDrawer/SelfManagementDrawerFooter.tsx +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtex/faststore-plugin-buyer-portal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A plugin for faststore with buyer portal",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@faststore/core": "^3.0.147",
|
|
12
|
-
"@
|
|
13
|
-
"@types/react
|
|
12
|
+
"@faststore/ui": "^3.0.147",
|
|
13
|
+
"@types/react": "^18.2.42",
|
|
14
14
|
"next": "13.5.6",
|
|
15
15
|
"typescript": "4.7.3"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@faststore/core": "^3.0.147",
|
|
19
|
+
"@faststore/ui": "^3.0.147",
|
|
19
20
|
"next": "13.5.6"
|
|
20
21
|
},
|
|
21
22
|
"license": "MIT"
|
|
@@ -4,7 +4,7 @@ import { CustomerSwitchSearch } from "./CustomerSwitchSearch";
|
|
|
4
4
|
import { CustomerSwitchOptionsList } from "./CustomerSwitchOptionsList";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import { CustomerSwitchOptionData } from "./CustomerSwitchOption";
|
|
7
|
-
import
|
|
7
|
+
import * as Icons from "../Icons";
|
|
8
8
|
|
|
9
9
|
type CustomerSwitchDrawerProps = {
|
|
10
10
|
isOpen: boolean;
|
|
@@ -42,10 +42,8 @@ const options = [
|
|
|
42
42
|
"Lighthouse Consulting Group",
|
|
43
43
|
"Stellar Synergy",
|
|
44
44
|
"FinanceCore Solutions",
|
|
45
|
-
"Nova Finance Advisors"
|
|
46
|
-
].map(
|
|
47
|
-
(name, index) => ({ name, id: `id-${index}` })
|
|
48
|
-
);
|
|
45
|
+
"Nova Finance Advisors",
|
|
46
|
+
].map((name, index) => ({ name, id: `id-${index}` }));
|
|
49
47
|
|
|
50
48
|
export const CustomerSwitchDrawer = ({
|
|
51
49
|
isOpen,
|
|
@@ -54,24 +52,24 @@ export const CustomerSwitchDrawer = ({
|
|
|
54
52
|
const { fade, fadeOut } = useFadeEffect();
|
|
55
53
|
|
|
56
54
|
const [option, setOption] = useState<CustomerSwitchOptionData>(options[0]);
|
|
57
|
-
const [loading, setLoading] = useState(false)
|
|
58
|
-
const [searchTerm, setSearchTerm] = useState("")
|
|
55
|
+
const [loading, setLoading] = useState(false);
|
|
56
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
59
57
|
|
|
60
58
|
const filteredOptions = useMemo(() => {
|
|
61
59
|
if (!searchTerm) {
|
|
62
60
|
return options;
|
|
63
61
|
}
|
|
64
|
-
return options.filter(currentOption =>
|
|
62
|
+
return options.filter((currentOption) =>
|
|
65
63
|
currentOption.name?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
66
64
|
);
|
|
67
65
|
}, [options, searchTerm]);
|
|
68
66
|
|
|
69
67
|
const handleSubmitCustomer = () => {
|
|
70
68
|
console.log(option);
|
|
71
|
-
setLoading(true)
|
|
69
|
+
setLoading(true);
|
|
72
70
|
setTimeout(() => {
|
|
73
|
-
setLoading(false)
|
|
74
|
-
onCloseDrawer?.()
|
|
71
|
+
setLoading(false);
|
|
72
|
+
onCloseDrawer?.();
|
|
75
73
|
}, 3000);
|
|
76
74
|
};
|
|
77
75
|
|
|
@@ -107,11 +105,7 @@ export const CustomerSwitchDrawer = ({
|
|
|
107
105
|
onClick={handleSubmitCustomer}
|
|
108
106
|
disabled={option.id === options[0].id || loading}
|
|
109
107
|
>
|
|
110
|
-
{
|
|
111
|
-
loading ?
|
|
112
|
-
<CustomerSwitchLoad /> :
|
|
113
|
-
"Confirm"
|
|
114
|
-
}
|
|
108
|
+
{loading ? <Icons.Load width={16} height={16} /> : "Confirm"}
|
|
115
109
|
</Button>
|
|
116
110
|
</footer>
|
|
117
111
|
</SlideOver>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IconProps } from ".";
|
|
2
|
+
|
|
3
|
+
export const Link = ({ ...props }: IconProps) => (
|
|
4
|
+
<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
viewBox="0 0 10 10"
|
|
7
|
+
fill="none"
|
|
8
|
+
{...props}
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
fill-rule="evenodd"
|
|
12
|
+
clip-rule="evenodd"
|
|
13
|
+
d="M1.75 1C1.75 0.585786 2.08579 0.25 2.5 0.25H9C9.41421 0.25 9.75 0.585786 9.75 1V7.5C9.75 7.91421 9.41421 8.25 9 8.25C8.58579 8.25 8.25 7.91421 8.25 7.5V2.81066L1.53033 9.53033C1.23744 9.82322 0.762563 9.82322 0.46967 9.53033C0.176777 9.23744 0.176777 8.76256 0.46967 8.46967L7.18934 1.75H2.5C2.08579 1.75 1.75 1.41421 1.75 1Z"
|
|
14
|
+
fill="#3D3D3D"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
height="16px"
|
|
6
|
-
viewBox="0 0 24 24"
|
|
7
|
-
>
|
|
1
|
+
import { IconProps } from ".";
|
|
2
|
+
|
|
3
|
+
export const Load = ({ ...props }: IconProps) => (
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props}>
|
|
8
5
|
<g stroke="currentColor">
|
|
9
6
|
<circle
|
|
10
7
|
cx="12"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconProps } from ".";
|
|
2
|
+
|
|
3
|
+
export const Profile = ({ ...props }: IconProps) => (
|
|
4
|
+
<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
viewBox="0 0 14 14"
|
|
7
|
+
fill="none"
|
|
8
|
+
{...props}
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
d="M7.00065 7.00114C6.08398 7.00114 5.29926 6.67475 4.64648 6.02197C3.99371 5.3692 3.66732 4.58447 3.66732 3.66781C3.66732 2.75114 3.99371 1.96642 4.64648 1.31364C5.29926 0.660862 6.08398 0.334473 7.00065 0.334473C7.91732 0.334473 8.70204 0.660862 9.35482 1.31364C10.0076 1.96642 10.334 2.75114 10.334 3.66781C10.334 4.58447 10.0076 5.3692 9.35482 6.02197C8.70204 6.67475 7.91732 7.00114 7.00065 7.00114ZM0.333984 13.6678V11.3345C0.333984 10.8623 0.455512 10.4282 0.698568 10.0324C0.941623 9.63656 1.26454 9.33447 1.66732 9.12614C2.52843 8.69559 3.40343 8.37267 4.29232 8.15739C5.18121 7.94211 6.08398 7.83447 7.00065 7.83447C7.91732 7.83447 8.8201 7.94211 9.70899 8.15739C10.5979 8.37267 11.4729 8.69559 12.334 9.12614C12.7368 9.33447 13.0597 9.63656 13.3027 10.0324C13.5458 10.4282 13.6673 10.8623 13.6673 11.3345V13.6678H0.333984Z"
|
|
12
|
+
fill="#0366DD"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Image_unstable as Image } from "@faststore/core/experimental";
|
|
2
|
+
|
|
3
|
+
const logoSrc =
|
|
4
|
+
"https://b2bfaststoredev.vtexassets.com/unsafe/1440x0/center/middle/https%3A%2F%2Fstoreframework.vtexassets.com%2Fassets%2Fvtex.file-manager-graphql%2Fimages%2Fab9997f4-8fd6-46f5-99d2-9d5af3ef5e34___6d75a203771d7408d8f0d1c660a076dd.png";
|
|
5
|
+
|
|
6
|
+
export const Logo = () => (
|
|
7
|
+
<div data-fs-logo>
|
|
8
|
+
<Image
|
|
9
|
+
alt="Logo"
|
|
10
|
+
src={logoSrc}
|
|
11
|
+
width={0}
|
|
12
|
+
height={0}
|
|
13
|
+
sizes="15vw"
|
|
14
|
+
loading="lazy"
|
|
15
|
+
style={{ width: "100%", height: "auto" }}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Icons from "../Icons";
|
|
2
|
+
import { Logo } from "../Logo/Logo";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
|
|
5
|
+
import { Dropdown, DropdownMenu, DropdownButton } from "@faststore/ui";
|
|
6
|
+
import { ProfileSummary } from "../ProfileSummary/ProfileSummary";
|
|
7
|
+
import { doLogout } from "../../utils/logout";
|
|
8
|
+
import { profileData } from "../../mock/profile-data";
|
|
9
|
+
|
|
10
|
+
export const Navbar = () => {
|
|
11
|
+
return (
|
|
12
|
+
<header data-fs-buyer-portal-navbar>
|
|
13
|
+
<Logo />
|
|
14
|
+
<div data-fs-header-actions>
|
|
15
|
+
<Link href="/" data-fs-start-shopping-link>
|
|
16
|
+
<span>Start Shopping</span>
|
|
17
|
+
<Icons.Link width={10} height={10} />
|
|
18
|
+
</Link>
|
|
19
|
+
<Dropdown>
|
|
20
|
+
<DropdownButton asChild>
|
|
21
|
+
<button data-fs-profile-dropdown-trigger>
|
|
22
|
+
<Icons.Profile width={14} height={14} />
|
|
23
|
+
</button>
|
|
24
|
+
</DropdownButton>
|
|
25
|
+
|
|
26
|
+
<DropdownMenu align="right" data-fs-profile-dropdown-menu>
|
|
27
|
+
<ProfileSummary
|
|
28
|
+
data-fs-profile-dropdown-menu-profile-summary
|
|
29
|
+
onLogoutClick={doLogout}
|
|
30
|
+
{...profileData}
|
|
31
|
+
/>
|
|
32
|
+
</DropdownMenu>
|
|
33
|
+
</Dropdown>
|
|
34
|
+
</div>
|
|
35
|
+
</header>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[data-fs-buyer-portal-navbar] {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
padding: var(--fs-spacing-3) calc(var(--fs-spacing-8) + var(--fs-spacing-0));
|
|
6
|
+
background-color: #f5f5f5;
|
|
7
|
+
|
|
8
|
+
[data-fs-header-actions] {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-fs-start-shopping-link] {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
|
|
18
|
+
color: #3d3d3d;
|
|
19
|
+
font-weight: var(--fs-text-weight-semibold);
|
|
20
|
+
font-family: "Inter", sans-serif;
|
|
21
|
+
line-height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
22
|
+
font-size: var(--fs-text-size-2);
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
margin-right: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
25
|
+
|
|
26
|
+
span {
|
|
27
|
+
margin-right: var(--fs-spacing-0);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-fs-profile-dropdown-trigger] {
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
border-radius: var(--fs-border-radius-circle);
|
|
36
|
+
background-color: #cbe9ff;
|
|
37
|
+
width: var(--fs-spacing-5);
|
|
38
|
+
height: var(--fs-spacing-5);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-fs-profile-dropdown-menu] {
|
|
43
|
+
--fs-profile-dropdown-menu-width: 360px;
|
|
44
|
+
|
|
45
|
+
background-color: white;
|
|
46
|
+
|
|
47
|
+
[data-fs-profile-dropdown-menu-profile-summary] {
|
|
48
|
+
min-width: var(--fs-profile-dropdown-menu-width);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Button } from "@faststore/ui";
|
|
3
|
+
import * as Icons from "../Icons";
|
|
4
|
+
|
|
5
|
+
export type ProfileSummaryProps = {
|
|
6
|
+
onLogoutClick?: (storeConfig: any) => void;
|
|
7
|
+
orgName: string;
|
|
8
|
+
bordered?: boolean;
|
|
9
|
+
person: {
|
|
10
|
+
image?: ReactNode;
|
|
11
|
+
name: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ProfileSummary = ({
|
|
17
|
+
onLogoutClick,
|
|
18
|
+
person: { image, name, role },
|
|
19
|
+
orgName,
|
|
20
|
+
bordered = false,
|
|
21
|
+
...otherProps
|
|
22
|
+
}: ProfileSummaryProps) => {
|
|
23
|
+
return (
|
|
24
|
+
<section
|
|
25
|
+
data-fs-self-profile-summary
|
|
26
|
+
data-fs-self-profile-summary-bordered={bordered}
|
|
27
|
+
{...otherProps}
|
|
28
|
+
>
|
|
29
|
+
<h2 data-fs-self-profile-summary-org-name>{orgName}</h2>
|
|
30
|
+
<div data-fs-self-profile-summary-person-actions>
|
|
31
|
+
<div data-fs-self-profile-summary-person-image>
|
|
32
|
+
{image ?? <Icons.Profile width={14} height={14} />}
|
|
33
|
+
</div>
|
|
34
|
+
<div data-fs-self-profile-summary-person-data>
|
|
35
|
+
<h2>{name}</h2>
|
|
36
|
+
{role && <h3>{role}</h3>}
|
|
37
|
+
</div>
|
|
38
|
+
<Button
|
|
39
|
+
data-fs-self-profile-summary-logout-button
|
|
40
|
+
onClick={onLogoutClick}
|
|
41
|
+
variant="secondary"
|
|
42
|
+
size="small"
|
|
43
|
+
>
|
|
44
|
+
Logout
|
|
45
|
+
</Button>
|
|
46
|
+
</div>
|
|
47
|
+
</section>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[data-fs-self-profile-summary] {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
&[data-fs-self-profile-summary-bordered="true"] {
|
|
7
|
+
border: var(--fs-border-width) solid #e0e0e0;
|
|
8
|
+
border-radius: var(--fs-border-radius);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[data-fs-self-profile-summary-org-name] {
|
|
13
|
+
font-size: var(--fs-text-size-legend);
|
|
14
|
+
color: #000000;
|
|
15
|
+
font-weight: var(--fs-text-weight-semibold);
|
|
16
|
+
padding: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
17
|
+
border-bottom: var(--fs-border-width) solid #e0e0e0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-fs-self-profile-summary-person-actions] {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
padding: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
24
|
+
|
|
25
|
+
[data-fs-self-profile-summary-person-image] {
|
|
26
|
+
width: var(--fs-spacing-6);
|
|
27
|
+
height: var(--fs-spacing-6);
|
|
28
|
+
border-radius: var(--fs-border-radius-pill);
|
|
29
|
+
background-color: #cbe9ff;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
color: var(--fs-border-color-active);
|
|
35
|
+
margin-right: var(--fs-spacing-3);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[data-fs-self-profile-summary-person-data] {
|
|
39
|
+
flex: 1;
|
|
40
|
+
font-size: var(--fs-text-size-legend);
|
|
41
|
+
|
|
42
|
+
h2 {
|
|
43
|
+
color: var(--fs-color-text);
|
|
44
|
+
font-weight: var(--fs-text-weight-regular);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
h3 {
|
|
48
|
+
color: var(--fs-color-text-light);
|
|
49
|
+
font-weight: var(--fs-text-weight-light);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[data-fs-self-profile-summary-logout-button] {
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
color: #d31a15;
|
|
56
|
+
font-weight: var(--fs-text-weight-semibold);
|
|
57
|
+
|
|
58
|
+
[data-fs-button-wrapper] {
|
|
59
|
+
border-radius: var(--fs-border-radius-pill);
|
|
60
|
+
color: var(--fs-color-danger-text);
|
|
61
|
+
border: var(--fs-border-width) solid var(--fs-border-color-light);
|
|
62
|
+
padding: var(--fs-spacing-1) var(--fs-spacing-4);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-fs-button-wrapper]:hover {
|
|
66
|
+
color: var(--fs-color-danger-text);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
[data-fs-icon] {
|
|
70
|
+
color: var(--fs-color-danger-text);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { SlideOver, useFadeEffect } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { SelfManagementDrawerHeader } from "./SelfManagementDrawerHeader";
|
|
4
|
-
import { SelfManagementDrawerFooter } from "./SelfManagementDrawerFooter";
|
|
5
4
|
import { SelfManagementDrawerBody } from "./SelfManagementDrawerBody";
|
|
6
5
|
import { doLogout } from "../../utils/logout";
|
|
7
6
|
import { useState } from "react";
|
|
8
7
|
import { CustomerSwitchDrawer } from "../CustomerSwitch/CustomerSwitchDrawer";
|
|
8
|
+
import { ProfileSummary } from "../ProfileSummary/ProfileSummary";
|
|
9
|
+
import { profileData } from "../../mock/profile-data";
|
|
9
10
|
|
|
10
11
|
type SelfManagementDrawerProps = {
|
|
11
12
|
isOpen: boolean;
|
|
@@ -37,13 +38,13 @@ export const SelfManagementDrawer = ({
|
|
|
37
38
|
orgUrl="/self-management"
|
|
38
39
|
/>
|
|
39
40
|
<SelfManagementDrawerBody />
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
<footer data-fs-self-management-drawer-footer-wrapper>
|
|
42
|
+
<ProfileSummary
|
|
43
|
+
bordered={true}
|
|
44
|
+
onLogoutClick={doLogout}
|
|
45
|
+
{...profileData}
|
|
46
|
+
/>
|
|
47
|
+
</footer>
|
|
47
48
|
</SlideOver>
|
|
48
49
|
{openCustomerDrawer && (
|
|
49
50
|
<CustomerSwitchDrawer
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "@faststore/ui";
|
|
2
|
+
import { Button, IconButton, SlideOverHeader, Link, Icon } from "@faststore/ui";
|
|
3
|
+
import * as Icons from "../Icons";
|
|
5
4
|
|
|
6
5
|
export type SelfManagementDrawerHeaderProps = {
|
|
7
6
|
onCloseDrawer?: () => void;
|
|
@@ -22,38 +21,14 @@ export const SelfManagementDrawerHeader = ({
|
|
|
22
21
|
}: SelfManagementDrawerHeaderProps) => {
|
|
23
22
|
return (
|
|
24
23
|
<>
|
|
25
|
-
<SlideOverHeader onClose={() => onCloseDrawer?.()} children={null}/>
|
|
24
|
+
<SlideOverHeader onClose={() => onCloseDrawer?.()} children={null} />
|
|
26
25
|
<div data-fs-self-management-drawer-header>
|
|
27
26
|
<Link data-fs-self-management-drawer-header-org-link href={orgUrl}>
|
|
28
27
|
<div data-fs-self-management-drawer-header-org-image>
|
|
29
|
-
{orgImage ?? <
|
|
28
|
+
{orgImage ?? <Icons.Profile width={24} height={24} />}
|
|
30
29
|
</div>
|
|
31
|
-
<h1 data-fs-self-management-drawer-header-org-name>
|
|
32
|
-
{orgName}
|
|
33
|
-
</h1>
|
|
30
|
+
<h1 data-fs-self-management-drawer-header-org-name>{orgName}</h1>
|
|
34
31
|
</Link>
|
|
35
|
-
|
|
36
|
-
<div data-fs-self-management-drawer-header-buttons-wrapper>
|
|
37
|
-
<Button
|
|
38
|
-
data-fs-self-management-drawer-header-switch-button
|
|
39
|
-
icon={<Icon name="Bell" />}
|
|
40
|
-
iconPosition="left"
|
|
41
|
-
onClick={() => onSwitchButtonClick?.()}
|
|
42
|
-
variant="secondary"
|
|
43
|
-
size="small"
|
|
44
|
-
>
|
|
45
|
-
Switch
|
|
46
|
-
</Button>
|
|
47
|
-
|
|
48
|
-
<IconButton
|
|
49
|
-
data-fs-self-management-drawer-header-config-button
|
|
50
|
-
icon={<Icon name="FadersHorizontal" />}
|
|
51
|
-
aria-label="Buy"
|
|
52
|
-
onClick={() => onConfigButtonClick?.()}
|
|
53
|
-
variant="secondary"
|
|
54
|
-
size="small"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
32
|
</div>
|
|
58
33
|
</>
|
|
59
34
|
);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { SelfManagementDrawer } from "./SelfManagementDrawer";
|
|
2
2
|
export { SelfManagementDrawerHeader } from "./SelfManagementDrawerHeader";
|
|
3
3
|
export { SelfManagementDrawerBody } from "./SelfManagementDrawerBody";
|
|
4
|
-
export { SelfManagementDrawerFooter } from "./SelfManagementDrawerFooter";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[data-fs-self-management-drawer] {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// Header
|
|
7
|
+
[data-fs-slide-over] [data-fs-slide-over-header] {
|
|
8
|
+
--fs-slide-over-header-height: 100px;
|
|
9
|
+
|
|
10
|
+
align-items: baseline;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
flex-direction: row-reverse;
|
|
13
|
+
background-color: #0366dd;
|
|
14
|
+
height: var(--fs-slide-over-header-height);
|
|
15
|
+
|
|
16
|
+
button {
|
|
17
|
+
color: white;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[data-fs-self-management-drawer-header] {
|
|
22
|
+
padding: 0 var(--fs-spacing-8);
|
|
23
|
+
display: flex;
|
|
24
|
+
width: 100%;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
align-items: flex-end;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-fs-self-management-drawer-header-org-link] {
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[data-fs-self-management-drawer-header-org-name] {
|
|
34
|
+
font-weight: var(--fs-text-weight-bold);
|
|
35
|
+
font-size: var(--fs-text-size-3);
|
|
36
|
+
color: var(--fs-color-text);
|
|
37
|
+
text-transform: capitalize;
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
padding: var(--fs-spacing-1) 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-fs-self-management-drawer-header-org-name]:hover {
|
|
43
|
+
text-decoration: underline;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[data-fs-self-management-drawer-header-org-image] {
|
|
47
|
+
width: var(--fs-spacing-8);
|
|
48
|
+
height: var(--fs-spacing-8);
|
|
49
|
+
border-radius: var(--fs-border-radius-pill);
|
|
50
|
+
background-color: #cbe9ff;
|
|
51
|
+
border: var(--fs-border-width-thick) solid white;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
margin-bottom: var(--fs-spacing-1);
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
color: var(--fs-border-color-active);
|
|
58
|
+
|
|
59
|
+
transform: translateY(-50%);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Body
|
|
63
|
+
[data-fs-self-management-drawer-body] {
|
|
64
|
+
flex: 1;
|
|
65
|
+
|
|
66
|
+
[data-fs-self-mamnagement-drawer-body-contents] {
|
|
67
|
+
padding: var(--fs-spacing-5) var(--fs-spacing-8) var(--fs-spacing-5);
|
|
68
|
+
display: grid;
|
|
69
|
+
row-gap: var(--fs-spacing-4);
|
|
70
|
+
width: 100%;
|
|
71
|
+
|
|
72
|
+
[data-fs-self-management-drawer-body-link] {
|
|
73
|
+
color: var(--fs-color-neutral-7);
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[data-fs-self-management-drawer-body-link]:hover {
|
|
78
|
+
text-decoration: underline;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Footer
|
|
84
|
+
[data-fs-self-management-drawer-footer-wrapper] {
|
|
85
|
+
padding: var(--fs-spacing-4) var(--fs-spacing-8);
|
|
86
|
+
}
|
|
@@ -12,7 +12,8 @@ export const SelfManagementSignInButton = ({
|
|
|
12
12
|
const { ...session } = useSession();
|
|
13
13
|
|
|
14
14
|
const openDrawer = (event: any) => {
|
|
15
|
-
if (session.person) {
|
|
15
|
+
// if (session.person) {
|
|
16
|
+
if (true) {
|
|
16
17
|
event.preventDefault();
|
|
17
18
|
|
|
18
19
|
setIsOpen(true);
|
|
@@ -27,7 +28,7 @@ export const SelfManagementSignInButton = ({
|
|
|
27
28
|
<>
|
|
28
29
|
<LinkButton
|
|
29
30
|
data-fs-button-signin-link
|
|
30
|
-
href={session.person?.id ? `/account` : `/login`}
|
|
31
|
+
// href={session.person?.id ? `/account` : `/login`}
|
|
31
32
|
className="text__title-mini"
|
|
32
33
|
variant="tertiary"
|
|
33
34
|
icon={<Icon name={"User"} width={18} height={18} weight="bold" />}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Navbar } from "../components/Navbar/Navbar";
|
|
2
|
+
|
|
1
3
|
export type PageLoader = { page: string };
|
|
2
4
|
|
|
3
5
|
export async function loader(): Promise<PageLoader> {
|
|
@@ -5,5 +7,5 @@ export async function loader(): Promise<PageLoader> {
|
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
export default function MyAccount(data: PageLoader) {
|
|
8
|
-
return <
|
|
10
|
+
return <Navbar />;
|
|
9
11
|
}
|
package/src/themes/index.scss
CHANGED
|
@@ -1,180 +1,12 @@
|
|
|
1
1
|
@import "@faststore/ui/src/components/atoms/Overlay/styles.scss";
|
|
2
|
+
@import "@faststore/ui/src/components/atoms/Logo/styles.scss";
|
|
2
3
|
@import "@faststore/ui/src/components/organisms/SlideOver/styles.scss";
|
|
4
|
+
@import "@faststore/ui/src/components/molecules/Dropdown/styles.scss";
|
|
3
5
|
@import "../components/CustomerSwitch/customer-switch.scss";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
justify-content: center;
|
|
9
|
-
align-items: center;
|
|
10
|
-
width: 100%;
|
|
11
|
-
|
|
12
|
-
[data-fs-self-management-title] {
|
|
13
|
-
text-align: center;
|
|
14
|
-
font-size: x-large;
|
|
15
|
-
font-weight: bold;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[data-fs-self-management-title], [data-fs-self-management-code] {
|
|
19
|
-
margin-bottom: 32px;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
[data-fs-self-management-nav] {
|
|
25
|
-
padding: 8px;
|
|
26
|
-
background-color: var(--fs-border-color-light);
|
|
27
|
-
margin-bottom: 16px;
|
|
28
|
-
|
|
29
|
-
a {
|
|
30
|
-
margin-left: 8px;
|
|
31
|
-
text-decoration: none;
|
|
32
|
-
color: var(--fs-color-tertiary-text);
|
|
33
|
-
font-weight: bold;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[data-fs-self-management-drawer] {
|
|
38
|
-
@import "@faststore/ui/src/components/atoms/Button/styles.scss";
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// Header
|
|
44
|
-
[data-fs-self-management-drawer-header] {
|
|
45
|
-
padding: 0 var(--fs-spacing-8) var(--fs-spacing-5);
|
|
46
|
-
display: flex;
|
|
47
|
-
width: 100%;
|
|
48
|
-
justify-content: space-between;
|
|
49
|
-
align-items: flex-end;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
[data-fs-self-management-drawer-header-org-link] {
|
|
53
|
-
text-decoration: none;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
[data-fs-self-management-drawer-header-org-name] {
|
|
57
|
-
font-weight: var(--fs-text-weight-bold);
|
|
58
|
-
font-size: var(--fs-text-size-3);
|
|
59
|
-
color: var(--fs-color-text);
|
|
60
|
-
text-transform: capitalize;
|
|
61
|
-
text-decoration: none;
|
|
62
|
-
padding: var(--fs-spacing-1) 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
[data-fs-self-management-drawer-header-org-name]:hover {
|
|
66
|
-
text-decoration: underline;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
[data-fs-self-management-drawer-header-org-image] {
|
|
70
|
-
width: var(--fs-spacing-9);
|
|
71
|
-
height: var(--fs-spacing-9);
|
|
72
|
-
border-radius: var(--fs-border-radius-pill);
|
|
73
|
-
background-color: var(--fs-color-light);
|
|
74
|
-
display: flex;
|
|
75
|
-
align-items: center;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
margin-bottom: var(--fs-spacing-1);
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
color: var(--fs-border-color-active);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
[data-fs-self-management-drawer-header-buttons-wrapper] {
|
|
83
|
-
display: flex;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
[data-fs-self-management-drawer-header-config-button] {
|
|
87
|
-
margin-right: calc(-1 * var(--fs-spacing-1));
|
|
88
|
-
border-radius: var(--fs-border-radius-full);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
[data-fs-self-management-drawer-header-switch-button] {
|
|
92
|
-
[data-fs-button-wrapper] {
|
|
93
|
-
border-radius: var(--fs-border-radius-pill);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Body
|
|
98
|
-
[data-fs-self-management-drawer-body] {
|
|
99
|
-
flex: 1;
|
|
100
|
-
border-top: var(--fs-border-radius-small) var(--fs-color-neutral-3);
|
|
101
|
-
border-top-style: solid;
|
|
102
|
-
border-bottom: var(--fs-border-radius-small) var(--fs-color-neutral-3);
|
|
103
|
-
border-bottom-style: solid;
|
|
104
|
-
|
|
105
|
-
[data-fs-self-mamnagement-drawer-body-contents] {
|
|
106
|
-
padding: var(--fs-spacing-5) var(--fs-spacing-8) var(--fs-spacing-5);
|
|
107
|
-
display: grid;
|
|
108
|
-
row-gap: var(--fs-spacing-4);
|
|
109
|
-
width: 100%;
|
|
110
|
-
|
|
111
|
-
[data-fs-self-management-drawer-body-link] {
|
|
112
|
-
color: var(--fs-color-neutral-7);
|
|
113
|
-
text-decoration: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
[data-fs-self-management-drawer-body-link]:hover {
|
|
117
|
-
text-decoration: underline;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// Footer
|
|
125
|
-
[data-fs-self-management-drawer-footer] {
|
|
126
|
-
padding: var(--fs-spacing-4) var(--fs-spacing-8);
|
|
127
|
-
display: flex;
|
|
128
|
-
justify-content: space-between;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
[data-fs-self-management-drawer-footer-person-image] {
|
|
132
|
-
width: var(--fs-spacing-6);
|
|
133
|
-
height: var(--fs-spacing-6);
|
|
134
|
-
border-radius: var(--fs-border-radius-pill);
|
|
135
|
-
background-color: var(--fs-color-light);
|
|
136
|
-
display: flex;
|
|
137
|
-
align-items: center;
|
|
138
|
-
justify-content: center;
|
|
139
|
-
overflow: hidden;
|
|
140
|
-
color: var(--fs-border-color-active);
|
|
141
|
-
margin-right: var(--fs-spacing-3);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
[data-fs-self-management-drawer-footer-person-data] {
|
|
145
|
-
flex: 1;
|
|
146
|
-
font-size: var(--fs-text-size-legend);
|
|
147
|
-
|
|
148
|
-
h2 {
|
|
149
|
-
color: var(--fs-color-text);
|
|
150
|
-
font-weight: var(--fs-text-weight-regular);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
h3 {
|
|
154
|
-
color: var(--fs-color-text-light);
|
|
155
|
-
font-weight: var(--fs-text-weight-light);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
[data-fs-self-management-drawer-footer-logout-button] {
|
|
160
|
-
&[data-fs-self-management-drawer-footer-logout-button-color="danger"] {
|
|
161
|
-
|
|
162
|
-
[data-fs-button-wrapper] {
|
|
163
|
-
border-radius: var(--fs-border-radius-pill);
|
|
164
|
-
color: var(--fs-color-danger-text);
|
|
165
|
-
border-color: var(--fs-border-color-light);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
[data-fs-button-wrapper]:hover {
|
|
169
|
-
color: var(--fs-color-danger-text);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
[data-fs-icon] {
|
|
173
|
-
color: var(--fs-color-danger-text);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
6
|
+
@import "../components/Navbar/navbar.scss";
|
|
7
|
+
@import "../components/SelfManagementDrawer/self-management-drawer.scss";
|
|
8
|
+
@import "../components/SelfManagementDrawer/self-management-drawer.scss";
|
|
9
|
+
@import "../components/ProfileSummary/profile-summary.scss";
|
|
178
10
|
|
|
179
11
|
// ----------------------------------------------------------
|
|
180
12
|
// GLOBAL TOKENS
|
package/tsconfig.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"DOM.Iterable",
|
|
18
18
|
"ES2016"
|
|
19
19
|
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
|
20
|
-
"jsx": "
|
|
20
|
+
"jsx": "preserve" /* Specify what JSX code is generated. */,
|
|
21
21
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
22
22
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
23
23
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { Button, Icon } from "@faststore/ui";
|
|
3
|
-
|
|
4
|
-
export type SelfManagementDrawerFooterProps = {
|
|
5
|
-
onLogoutClick?: (storeConfig: any) => void;
|
|
6
|
-
person: {
|
|
7
|
-
image?: ReactNode;
|
|
8
|
-
name: string;
|
|
9
|
-
role?: string;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const SelfManagementDrawerFooter = ({
|
|
14
|
-
onLogoutClick,
|
|
15
|
-
person: {
|
|
16
|
-
image,
|
|
17
|
-
name,
|
|
18
|
-
role,
|
|
19
|
-
}
|
|
20
|
-
}: SelfManagementDrawerFooterProps) => {
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<footer data-fs-self-management-drawer-footer>
|
|
24
|
-
<div data-fs-self-management-drawer-footer-person-image>
|
|
25
|
-
{image ?? <Icon name="Bell" width={20} height={20} />}
|
|
26
|
-
</div>
|
|
27
|
-
<div data-fs-self-management-drawer-footer-person-data>
|
|
28
|
-
<h2>{name}</h2>
|
|
29
|
-
{role && <h3>{role}</h3>}
|
|
30
|
-
</div>
|
|
31
|
-
<Button
|
|
32
|
-
data-fs-self-management-drawer-footer-logout-button
|
|
33
|
-
data-fs-self-management-drawer-footer-logout-button-color="danger"
|
|
34
|
-
icon={<Icon name="Bell" weight="bold" />}
|
|
35
|
-
iconPosition="left"
|
|
36
|
-
onClick={onLogoutClick}
|
|
37
|
-
variant="secondary"
|
|
38
|
-
size="small"
|
|
39
|
-
>
|
|
40
|
-
Logout
|
|
41
|
-
</Button>
|
|
42
|
-
</footer>
|
|
43
|
-
);
|
|
44
|
-
};
|