├── .eslintrc.json
├── src
└── app
│ ├── components
│ ├── index.ts
│ ├── SidebarMenuItem.tsx
│ └── Sidebar.tsx
│ ├── favicon.ico
│ ├── shopping-cart
│ ├── index.ts
│ └── components
│ │ └── CartCounter.tsx
│ ├── page.tsx
│ ├── dashboard
│ ├── main
│ │ └── page.tsx
│ ├── counter
│ │ └── page.tsx
│ └── layout.tsx
│ ├── layout.tsx
│ └── globals.css
├── postcss.config.js
├── next.config.js
├── .gitignore
├── tailwind.config.js
├── public
├── vercel.svg
└── next.svg
├── package.json
├── tsconfig.json
└── README.md
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/src/app/components/index.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 | export { Sidebar } from './Sidebar';
--------------------------------------------------------------------------------
/src/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Klerith/next-my-dashboard/HEAD/src/app/favicon.ico
--------------------------------------------------------------------------------
/src/app/shopping-cart/index.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | export { CartCounter } from './components/CartCounter';
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/src/app/page.tsx:
--------------------------------------------------------------------------------
1 | import { redirect } from 'next/navigation';
2 |
3 | export default function HomePage() {
4 |
5 | redirect('/dashboard/main');
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/src/app/dashboard/main/page.tsx:
--------------------------------------------------------------------------------
1 |
2 | export default function MainPage() {
3 | return (
4 |
5 |
Hello Page Main
6 |
7 | );
8 | }
--------------------------------------------------------------------------------
/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | images: {
4 | remotePatterns: [
5 | {
6 | protocol: 'https',
7 | hostname: 'images.unsplash.com'
8 | },
9 |
10 | ]
11 | }
12 |
13 | }
14 |
15 | module.exports = nextConfig
16 |
--------------------------------------------------------------------------------
/src/app/dashboard/counter/page.tsx:
--------------------------------------------------------------------------------
1 | import { CartCounter } from "@/app/shopping-cart";
2 |
3 | export const metadata = {
4 | title: 'Shopping Cart',
5 | description: 'Un simple contador',
6 | };
7 |
8 |
9 | export default function CounterPage() {
10 |
11 |
12 | return (
13 |
14 | Productos en el carrito
15 |
16 |
17 |
18 | );
19 | }
--------------------------------------------------------------------------------
/src/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import './globals.css'
2 | import { Inter } from 'next/font/google'
3 |
4 | const inter = Inter({ subsets: ['latin'] })
5 |
6 | export const metadata = {
7 | title: 'Create Next App',
8 | description: 'Generated by create next app',
9 | }
10 |
11 | export default function RootLayout({
12 | children,
13 | }: {
14 | children: React.ReactNode
15 | }) {
16 | return (
17 |
18 | {children}
19 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/src/app/dashboard/layout.tsx:
--------------------------------------------------------------------------------
1 | import { Sidebar } from '../components';
2 |
3 | export default function DashboardLayout({ children }: { children: React.ReactNode; }) {
4 | return (
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | { children }
13 |
14 |
15 |
16 |
17 | );
18 | }
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [
4 | './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
5 | './src/components/**/*.{js,ts,jsx,tsx,mdx}',
6 | './src/app/**/*.{js,ts,jsx,tsx,mdx}',
7 | ],
8 | theme: {
9 | extend: {
10 | backgroundImage: {
11 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
12 | 'gradient-conic':
13 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
14 | },
15 | },
16 | },
17 | plugins: [],
18 | }
19 |
--------------------------------------------------------------------------------
/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | :root {
6 | --foreground-rgb: 0, 0, 0;
7 | --background-start-rgb: 214, 219, 220;
8 | --background-end-rgb: 255, 255, 255;
9 | }
10 |
11 | /* @media (prefers-color-scheme: dark) {
12 | :root {
13 | --foreground-rgb: 255, 255, 255;
14 | --background-start-rgb: 0, 0, 0;
15 | --background-end-rgb: 0, 0, 0;
16 | }
17 | } */
18 |
19 | body {
20 | color: rgb(var(--foreground-rgb));
21 | background: linear-gradient(
22 | to bottom,
23 | transparent,
24 | rgb(var(--background-end-rgb))
25 | )
26 | rgb(var(--background-start-rgb));
27 | }
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-dashboard",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.2.5",
13 | "@types/react": "18.2.9",
14 | "@types/react-dom": "18.2.4",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.42.0",
17 | "eslint-config-next": "13.4.4",
18 | "next": "13.4.4",
19 | "postcss": "8.4.24",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.9.0",
23 | "tailwindcss": "3.3.2",
24 | "typescript": "5.1.3"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./src/*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/src/app/shopping-cart/components/CartCounter.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 | import { useState } from 'react';
4 |
5 | interface Props {
6 | value?: number;
7 | }
8 |
9 |
10 |
11 | export const CartCounter = ({ value = 0 }: Props) => {
12 |
13 | const [count, setCount] = useState(value);
14 |
15 | return (
16 | <>
17 | {count}
18 |
19 |
20 | setCount(count + 1)}
22 | className="flex items-center justify-center p-2 rounded-xl bg-gray-900 text-white hover:bg-gray-600 transition-all w-[100px] mr-2">
23 | +1
24 |
25 |
26 | setCount(count - 1)}
28 | className="flex items-center justify-center p-2 rounded-xl bg-gray-900 text-white hover:bg-gray-600 transition-all w-[100px] mr-2">
29 | -1
30 |
31 |
32 | >
33 | )
34 | }
35 |
--------------------------------------------------------------------------------
/src/app/components/SidebarMenuItem.tsx:
--------------------------------------------------------------------------------
1 | 'use client';
2 |
3 |
4 | import Link from "next/link";
5 | import { usePathname } from "next/navigation";
6 |
7 | interface Props {
8 | path: string;
9 | icon: JSX.Element;
10 | title: string;
11 | subTitle: string;
12 | }
13 |
14 |
15 |
16 | export const SidebarMenuItem = ({ path, icon, title, subTitle }: Props) => {
17 |
18 | const currentPath = usePathname();
19 |
20 | return (
21 |
26 |
27 |
28 | { icon }
29 |
30 |
31 |
32 |
33 | { title }
34 | { subTitle }
35 |
36 |
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/public/next.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | # or
12 | pnpm dev
13 | ```
14 |
15 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16 |
17 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
18 |
19 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
20 |
21 | ## Learn More
22 |
23 | To learn more about Next.js, take a look at the following resources:
24 |
25 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27 |
28 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29 |
30 | ## Deploy on Vercel
31 |
32 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33 |
34 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
35 |
--------------------------------------------------------------------------------
/src/app/components/Sidebar.tsx:
--------------------------------------------------------------------------------
1 | import Image from 'next/image';
2 | import { IoBrowsersOutline, IoCalculator, IoLogoReact } from 'react-icons/io5';
3 | import { SidebarMenuItem } from './SidebarMenuItem';
4 |
5 |
6 | const menuItems = [
7 | {
8 | path: '/dashboard/main',
9 | icon: ,
10 | title: 'Dashboard',
11 | subTitle: 'Visualización'
12 | },
13 | {
14 | path: '/dashboard/counter',
15 | icon: ,
16 | title: 'Counter',
17 | subTitle: 'Contador Client Side'
18 | },
19 | ]
20 |
21 |
22 | export const Sidebar = () => {
23 | return (
24 |
25 |
83 | )
84 | }
85 |
--------------------------------------------------------------------------------