Skip to content

Commit

Permalink
Merge pull request #26 from design-sparx/ft/react-n-progress
Browse files Browse the repository at this point in the history
New features
  • Loading branch information
kelvink96 authored Sep 29, 2023
2 parents 8f02fbf + 740edc8 commit 48e4fd2
Show file tree
Hide file tree
Showing 20 changed files with 454 additions and 163 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-mirrors-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"antd-multi-dashboard": minor
---

Added react helmet to manage document heads
5 changes: 5 additions & 0 deletions .changeset/red-shirts-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"antd-multi-dashboard": minor
---

Added: - added react top progress bar - added sidebar collapse transitions
39 changes: 29 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<head>
<meta charset="UTF-8"/>
<link rel="icon" type="image/svg+xml" href="/vite.svg"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>
Multi dashboard template with React and Ant Design v5 - AntD Dashboard by Design Sparx
</title>
<meta
name="description"
content="Explore a powerful multi-dashboard application built with React and Ant Design (v5) for efficient data visualization and management. A large number of settings, additional services and widgets."/>
<meta
name="keywords"
content="Design Sparx, antd, antd5, admin themes, react, admin themes, antd admin, antd dashboard, antd dark mode"/>
<meta property="og:locale" content="en_US"/>
<meta property="og:type" content="article"/>
<meta
property="og:title"
content="Design Sparx – Multi dashboard template with React and Ant Design v5 - AntD Dashboard by Design Sparx"/>
<meta
property="og:url"
content="https://themes.getbootstrap.com/product/good-bootstrap-5-admin-dashboard-template"/>
<meta property="og:site_name" content="Good by Keenthemes"/>
<link rel="canonical" href="https://preview.keenthemes.com/good"/>
<link rel="shortcut icon" href="/favicon.ico"/>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@ant-design/charts": "^1.4.2",
"@ant-design/icons": "^5.2.5",
"@changesets/cli": "^2.26.2",
"@tanem/react-nprogress": "^5.0.51",
"antd": "^5.8.5",
"dayjs": "^1.11.9",
"history": "^5.3.0",
Expand All @@ -25,14 +26,16 @@
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-responsive": "^9.0.2",
"react-router-dom": "^6.15.0"
"react-router-dom": "^6.15.0",
"react-transition-group": "^4.4.5"
},
"devDependencies": {
"@types/lodash": "^4.14.197",
"@types/react": "^18.2.15",
"@types/react-calendar-timeline": "^0.28.2",
"@types/react-dom": "^18.2.7",
"@types/react-router-dom": "^5.3.3",
"@types/react-transition-group": "^4.4.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react-swc": "^3.3.2",
Expand Down
Binary file added public/logo-no-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*react transition group css*/
.page-enter {
opacity: 0;
}

.page-enter-active {
opacity: 1;
}

.page-exit {
opacity: 1;
}

.page-exit-active {
opacity: 0;
}

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

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

.right-to-left-enter {
transform: translateX(100%);
}
.right-to-left-enter-active {
transform: translateX(0);
transition:all 300ms ease;
}

.right-to-left-exit {
transform: translateX(0);
}
.right-to-left-exit-active {
transform: translateX(-100%);
transition:all 300ms ease;
}

.left-to-right-enter {
transform: translateX(-100%);
}
.left-to-right-enter-active {
transform: translateX(0);
transition:all 300ms ease;
}

.left-to-right-exit {
transform: translateX(0);
}
.left-to-right-exit-active {
transform: translateX(100%);
transition:all 300ms ease;
}
26 changes: 3 additions & 23 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
import {RouterProvider} from 'react-router-dom'
import routes from "./routes/routes.tsx";
import {ConfigProvider} from "antd";
import {Helmet, HelmetProvider} from "react-helmet-async"
import {HelmetProvider} from "react-helmet-async"

import "./App.css"

// color palettes: triadic #A1A7CB, #CBA1A7, #A7CBA1

function App() {
return (
<HelmetProvider>
<Helmet>
<title>
Multi dashboard template with React and Ant Design v5 - AntD Dashboard by Design Sparx
</title>
<meta
name="description"
content="Explore a powerful multi-dashboard application built with React and Ant Design (v5) for efficient data visualization and management. A large number of settings, additional services and widgets."/>
<meta
name="keywords"
content="Design Sparx, antd, antd5, admin themes, react, admin themes, antd admin, antd dashboard, antd dark mode"/>
<meta property="og:locale" content="en_US"/>
<meta property="og:type" content="article"/>
<meta
property="og:title"
content="Design Sparx – Multi dashboard template with React and Ant Design v5 - AntD Dashboard by Design Sparx"/>
<meta
property="og:url"
content="https://themes.getbootstrap.com/product/good-bootstrap-5-admin-dashboard-template"/>
<meta property="og:site_name" content="Good by Keenthemes"/>
<link rel="canonical" href="https://preview.keenthemes.com/good"/>
<link rel="shortcut icon" href="/favicon.ico"/>
</Helmet>
<ConfigProvider
theme={{
token: {
Expand Down
5 changes: 2 additions & 3 deletions src/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {Typography} from "antd";
import {LayoutOutlined} from "@ant-design/icons";
import {Image, Typography} from "antd";

type LogoProps = { color: "black" | "white" } & React.HTMLAttributes<HTMLDivElement>

const Logo = ({color, ...others}: LogoProps) => {
return (
<div {...others}>
<LayoutOutlined style={{color, fontSize: 24}}/>
<Image src="/logo-no-background.png" alt="design sparx logo" height={48} preview={false}/>
<Typography.Title level={4} type="secondary" style={{color, margin: 0}}>DesignSparx</Typography.Title>
</div>
);
Expand Down
35 changes: 35 additions & 0 deletions src/components/Nprogress/Bar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
type Props = {
animationDuration: number
progress: number
}

const Bar = ({animationDuration, progress}: Props) => (
<div
style={{
background: '#29d',
height: 2,
left: 0,
marginLeft: `${(-1 + progress) * 100}%`,
position: 'fixed',
top: 0,
transition: `margin-left ${animationDuration}ms linear`,
width: '100%',
zIndex: 1031,
}}
>
<div
style={{
boxShadow: '0 0 10px #29d, 0 0 5px #29d',
display: 'block',
height: '100%',
opacity: 1,
position: 'absolute',
right: 0,
transform: 'rotate(3deg) translate(0px, -4px)',
width: 100,
}}
/>
</div>
)

export default Bar
21 changes: 21 additions & 0 deletions src/components/Nprogress/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {ReactNode} from 'react'

type Props = {
animationDuration: number
isFinished: boolean
children: ReactNode
}

const Container = ({animationDuration, children, isFinished}: Props) => (
<div
style={{
opacity: isFinished ? 0 : 1,
pointerEvents: 'none',
transition: `opacity ${animationDuration}ms linear`,
}}
>
{children}
</div>
)

export default Container
28 changes: 28 additions & 0 deletions src/components/Nprogress/Progress.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {useNProgress} from "@tanem/react-nprogress";
import {Bar, Container, Nspinner} from "./index.ts";

type Props = {
isAnimating?: boolean
}

const Progress = ({isAnimating}: Props) => {
const {animationDuration, isFinished, progress} = useNProgress({
isAnimating,
})


return (
<Container animationDuration={animationDuration} isFinished={isFinished}>
<Bar animationDuration={animationDuration} progress={progress}/>
<Nspinner/>
{/*
This example doesn't use a spinner component so the UI stays
tidy. You're free to render whatever is appropriate for your
use-case.
*/
}
</Container>
)
}

export default Progress
29 changes: 29 additions & 0 deletions src/components/Nprogress/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import "./spinner.css"

const Spinner = () => (
<div
style={{
display: 'block',
position: 'fixed',
right: 15,
top: 15,
zIndex: 1031,
}}
>
<div
style={{
animation: '400ms linear infinite spinner',
borderBottom: '2px solid transparent',
borderLeft: '2px solid #29d',
borderRadius: '50%',
borderRight: '2px solid transparent',
borderTop: '2px solid #29d',
boxSizing: 'border-box',
height: 36,
width: 36,
}}
/>
</div>
)

export default Spinner
6 changes: 6 additions & 0 deletions src/components/Nprogress/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Bar from "./Bar.tsx"
import Container from "./Container.tsx"
import Progress from "./Progress.tsx"
import Spinner from "./Spinner.tsx"

export {Bar, Container, Progress as Nprogress, Spinner as Nspinner}
8 changes: 8 additions & 0 deletions src/components/Nprogress/spinner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@keyframes spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
7 changes: 6 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import NotificationsItem from "./NotificationsItem/NotificationsItem.tsx";
import NotificationsCard from "./NotificationsCard/NotificationsCard.tsx";
import Card from "./Card/Card.tsx";
import PageHeader from "./PageHeader/PageHeader.tsx";
import {Bar, Container, Nprogress} from "./Nprogress"


export {
Logo,
Expand Down Expand Up @@ -111,5 +113,8 @@ export {
NotificationsItem,
NotificationsCard,
Card,
PageHeader
PageHeader,
Bar,
Container,
Nprogress
}
5 changes: 3 additions & 2 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
PATH_LANDING
} from "./routes.ts"

export const DASHBOARD_ITEMS = [
const DASHBOARD_ITEMS = [
{title: 'default', path: PATH_DASHBOARD.default},
{title: 'projects', path: PATH_DASHBOARD.projects},
{title: 'ecommerce', path: PATH_DASHBOARD.ecommerce},
Expand Down Expand Up @@ -58,5 +58,6 @@ export {
PATH_FILE,
PATH_SOCIAL,
PATH_START,
PATH_LANDING
PATH_LANDING,
DASHBOARD_ITEMS
}
Loading

0 comments on commit 48e4fd2

Please sign in to comment.