Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished user profile pages #41

Merged
merged 5 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/fair-books-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"antd-multi-dashboard": patch
---

### Added
- added user profile to sitemap
- added active tab styles on the user profile page

### Updated
- updated sitemap card styles
- minor page-to-page transition update
5 changes: 5 additions & 0 deletions .changeset/mighty-kings-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"antd-multi-dashboard": minor
---

completed user profile pages and sections
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

.page-enter-active,
.page-exit-active {
transition: opacity 300ms;
transition: opacity 200ms;
}

.fade-enter-active,
Expand Down
29 changes: 15 additions & 14 deletions src/components/SitemapCard/SitemapCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Button, CardProps, List} from "antd";
import {Button, CardProps, Flex, Typography} from "antd";
import {Card} from "../index.ts";

import "./styles.css"
Expand All @@ -12,22 +12,23 @@ type Props = {

const SitemapCard = ({data, ...others}: Props) => {
return (
<Card title={data.title} className="sitemap-card card" {...others}>
<List
dataSource={data.links}
bordered={false}
renderItem={(item) => (
<List.Item key={`sitemap-${item.title}`}>
<Card {...others}>
<Flex vertical gap="middle">
<Typography.Title level={5} style={{margin: 0, textTransform: "capitalize"}}>
{data.title}
</Typography.Title>
<Flex gap="small" wrap="wrap">
{data.links.map(d =>
<Button
key={d.title}
type="link"
href={item.path}
style={{textTransform: "capitalize", marginLeft: ".5rem"}}
href={d.path}
style={{textTransform: "capitalize"}}
>
{item.title}
</Button>
</List.Item>
)}
/>
{d.title}
</Button>)}
</Flex>
</Flex>
</Card>
);
};
Expand Down
45 changes: 41 additions & 4 deletions src/layouts/userAccount/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import {AppLayout} from "../index.ts";
import {Col, Descriptions, DescriptionsProps, Image, Row, Tabs, TabsProps, theme, Typography} from "antd";
import {
Col,
ConfigProvider,
Descriptions,
DescriptionsProps,
Image,
Row,
Tabs,
TabsProps,
theme,
Typography
} from "antd";
import {Card} from "../../components";
import {Outlet, useNavigate} from "react-router-dom";
import {Outlet, useLocation, useNavigate} from "react-router-dom";
import {USER_PROFILE_ITEMS} from "../../constants";
import {useStylesContext} from "../../context";

const {Link} = Typography

import "./styles.css"
import {useEffect, useState} from "react";

const DESCRIPTION_ITEMS: DescriptionsProps['items'] = [
{
Expand Down Expand Up @@ -48,19 +60,44 @@ const UserAccountLayout = () => {
const {token: {borderRadius}} = theme.useToken()
const navigate = useNavigate()
const stylesContext = useStylesContext()
const location = useLocation()
const [activeKey, setActiveKey] = useState(TAB_ITEMS[0].key);

const onChange = (key: string) => {
navigate(key)
};

useEffect(() => {
console.log(location)
const k = TAB_ITEMS.find(d => location.pathname.includes(d.key))?.key || ""

console.log(k)
setActiveKey(k);
}, [location]);

return (
<>
<AppLayout>
<Card
className="user-profile-card-nav card"
actions={[
<Tabs defaultActiveKey="1" items={TAB_ITEMS} onChange={onChange}
style={{textTransform: "capitalize"}}/>
<ConfigProvider
theme={{
components: {
Tabs: {
colorBorderSecondary: "none",
},
}
}}
>
<Tabs
defaultActiveKey={activeKey}
activeKey={activeKey}
items={TAB_ITEMS}
onChange={onChange}
style={{textTransform: "capitalize"}}
/>
</ConfigProvider>
]}
>
<Row {...stylesContext?.rowProps}>
Expand Down
36 changes: 20 additions & 16 deletions src/pages/Sitemap.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import {SitemapCard} from "../components";
import {Col, Row, RowProps, Typography} from "antd";
import {CORPORATE_ITEMS, DASHBOARD_ITEMS} from "../constants";
import {Col, Flex, Row, Typography} from "antd";
import {CORPORATE_ITEMS, DASHBOARD_ITEMS, USER_PROFILE_ITEMS} from "../constants";
import {useStylesContext} from "../context";
import {BranchesOutlined} from "@ant-design/icons";

const ROW_PROPS: RowProps = {
gutter: [
{xs: 8, sm: 16, md: 24, lg: 32},
{xs: 8, sm: 16, md: 24, lg: 32}
]
}

const SITES = [
{
Expand All @@ -17,20 +13,28 @@ const SITES = [
{
title: "corporate",
links: CORPORATE_ITEMS
},
{
title: "user profile",
links: USER_PROFILE_ITEMS
}
]

const SitemapPage = () => {
const context = useStylesContext()

return (
<div>
<Typography.Title level={3}>Sitemap</Typography.Title>
<Row {...ROW_PROPS}>
{SITES.map(s =>
<Col xs={24} sm={12} lg={6} xl={6}>
<SitemapCard data={s}/>
</Col>
)}
</Row>
<Flex vertical gap="middle">
<Typography.Title level={3}><BranchesOutlined/>{' '}Sitemap</Typography.Title>
<Row {...context?.rowProps}>
{SITES.map(s =>
<Col xs={24} sm={12} md={8} lg={6} key={`col-${s.title}`}>
<SitemapCard data={s}/>
</Col>
)}
</Row>
</Flex>
</div>
);
};
Expand Down
Loading