Index: document/.env =================================================================== diff -u --- document/.env (revision 0) +++ document/.env (revision a05de7d808822160773971b6f868b9446346c9be) @@ -0,0 +1,9 @@ +# // Running locally +# APP_ENV=local +# // you change port of local/dev here to :8000 +# // do not forget to adjust `server.port` +# //ASSET_URL=http://localhost:5174 + +# // Running production build +VITE_APP_ENV=production +VITE_ASSET_URL=http://313.co.kr/php/gnuboard5/bbs/board.php?bo_table=manual \ No newline at end of file Index: document/package.json =================================================================== diff -u -r93189d7b02c2b27640f81219ac466c32fe868de1 -ra05de7d808822160773971b6f868b9446346c9be --- document/package.json (.../package.json) (revision 93189d7b02c2b27640f81219ac466c32fe868de1) +++ document/package.json (.../package.json) (revision a05de7d808822160773971b6f868b9446346c9be) @@ -43,6 +43,7 @@ "clsx": "^2.1.1", "cmdk": "1.0.0", "date-fns": "^3.6.0", + "dotenv": "^16.4.5", "embla-carousel-react": "^8.1.8", "html-react-parser": "^5.1.12", "input-otp": "^1.2.4", @@ -57,6 +58,7 @@ "react-router-dom": "^6.26.1", "recharts": "^2.12.7", "sonner": "^1.5.0", + "styled-components": "^6.1.12", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "vaul": "^0.9.1", Index: document/src/App.jsx =================================================================== diff -u -r93189d7b02c2b27640f81219ac466c32fe868de1 -ra05de7d808822160773971b6f868b9446346c9be --- document/src/App.jsx (.../App.jsx) (revision 93189d7b02c2b27640f81219ac466c32fe868de1) +++ document/src/App.jsx (.../App.jsx) (revision a05de7d808822160773971b6f868b9446346c9be) @@ -1,27 +1,33 @@ -import { BrowserRouter, Routes, Route } from 'react-router-dom' +import { Routes, Route } from 'react-router-dom' import { ThemeProvider } from '@/components/shadcn/theme-provider' +import Layout from '@/layout/Layout' import Dashboard from "@/pages/Dashboard" import '@/assets/css/globals.css' import '@/assets/css/test.css' +import { SubMenuContextProvider } from '@/contexts/contexts' /* +SubMenuContextProvider : 헤더 서브 메뉴 전역 변수 제공 ThemeProvider : 테마 관리 -BrowserRouter : URL 변경 시 렌더링할 컴포넌트 Routes : URL 경로와 컴포넌트를 매핑하는 컨테이너 Route : 사용자가 접근할 url 컴포넌트 PropTypes : 타입과 형식을 따르는지 검증하는 도구 */ -function App() { +export const Guide = () => { + return
Guide page
+} +function App() { return ( - <> - - + + - } /> + }> + } /> + } /> + - - - + + ) } Index: document/src/components/shadcn/theme-provider.jsx =================================================================== diff -u -r93189d7b02c2b27640f81219ac466c32fe868de1 -ra05de7d808822160773971b6f868b9446346c9be --- document/src/components/shadcn/theme-provider.jsx (.../theme-provider.jsx) (revision 93189d7b02c2b27640f81219ac466c32fe868de1) +++ document/src/components/shadcn/theme-provider.jsx (.../theme-provider.jsx) (revision a05de7d808822160773971b6f868b9446346c9be) @@ -1,6 +1,5 @@ import { createContext, useContext, useEffect, useState } from 'react'; import PropTypes from 'prop-types'; - // 테마 const allowedThemes = ['dark', 'light']; Index: document/src/contexts/contexts.jsx =================================================================== diff -u --- document/src/contexts/contexts.jsx (revision 0) +++ document/src/contexts/contexts.jsx (revision a05de7d808822160773971b6f868b9446346c9be) @@ -0,0 +1,57 @@ +import { createContext, useEffect, useState } from "react" +import { + MonitorDown, + Home, + Settings, + PackagePlus, + BookHeart, + Loader, + } from "lucide-react" + +export const SubMenuContext = createContext(); + +export const SubMenuContextProvider = ({children}) => { + + const value = [ + { + to: "/", + title: "Getting Started", + Icon: ()=> (), + }, + { + to: "/guide", + title: "Guide", + Icon: ()=> (), + }, + { + to: "#", + title: "Reference", + Icon: ()=> (), + }, + { + to: "#", + title: "Still need help?", + Icon: ()=> (), + subMenus: [ + { id: 1, to: '/', title: 'submenu 1' }, + { id: 2, to: '#', title: 'submenu 2' }, + { id: 3, to: '#', title: 'submenu 3' }, + ] + }, + { + to: "#", + title: "Community", + Icon: ()=> (), + subMenus: [ + { id: 1, to: '#', title: 'submenu 1' }, + { id: 2, to: '#', title: 'submenu 2' }, + ] + }, + ]; + + return ( + + {children} + + ); +}; Index: document/src/layout/HeaderMenu.component.jsx =================================================================== diff -u --- document/src/layout/HeaderMenu.component.jsx (revision 0) +++ document/src/layout/HeaderMenu.component.jsx (revision a05de7d808822160773971b6f868b9446346c9be) @@ -0,0 +1,83 @@ +import { Link } from 'react-router-dom'; +import { Menu, Settings } from "lucide-react" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, + } from "@/components/shadcn/ui/dropdown-menu" +import { Button } from "@/components/shadcn/ui/button" +import { Sheet, SheetContent, SheetTrigger } from "@/components/shadcn/ui/sheet" +import ModeToggle from '@/components/shadcn/mode-toggle' // 테마 토글 버튼 Theme Button +import { SubMenu } from './HeaderMenu' + +const HeaderMenuComponents = () => { + return ( + <> + {/* 모바일 Breakpoint 좌측 사이드 메뉴 -- mobile menu & top right menu start -- */} +
+ + + + + + + + +
+
+
+ {/* -- Top Search Bar -- */} + {/* + */} +
+
+
+ {/* 상단 세팅 아이콘 메뉴 -- Top account dropdown menu -- */} + + + + + + My Account + + Settings + Support + + Logout + + + {/* 상단 세팅 아이콘 메뉴 End -- Top account dropdown menu end -- */} + {/* 테마 토글 아이콘 -- Dark / Light Theme Toggle Button -- */} + +
+ + ) +} + +export default HeaderMenuComponents \ No newline at end of file Index: document/src/layout/HeaderMenu.jsx =================================================================== diff -u --- document/src/layout/HeaderMenu.jsx (revision 0) +++ document/src/layout/HeaderMenu.jsx (revision a05de7d808822160773971b6f868b9446346c9be) @@ -0,0 +1,81 @@ +import React, { useContext } from 'react' +import { Link } from 'react-router-dom' +import { SubMenuContext } from '../contexts/contexts' +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@/components/shadcn/ui/accordion" + + +export const AccordionMenu = ({ title, to }) => { + return ( + + {title} + + ) +} + +export const SubMenu = () => { + const subMenuItems = useContext(SubMenuContext) + + return ( + <> + {subMenuItems.map((item, index) => + item.subMenus && item.subMenus.length > 0 ? ( // 메뉴 Data에 서브메뉴가 있을 시 아코디언 컴포넌트로 출력 + + + + + {item.title} + +
+ {/* 아코디언 서브 메뉴 출력 */} + {item.subMenus.map((el) => ( + + ))} + {/* 아코디언 서브 메뉴 출력 END */} +
+
+
+ ) : ( + // 서브메뉴가 없을 시 기본 메뉴로 출력 + + + {item.title} + + ) + )} + + ) +} + +const HeaderMenu = () => { + return ( + <> +
+
+
+ {/* 상단 브랜드 로고 -- Page Header -- */} + + 313 DEV GRP + +
+
+ +
+
+
+ + ) +} + +export default HeaderMenu \ No newline at end of file Index: document/src/layout/Layout.jsx =================================================================== diff -u --- document/src/layout/Layout.jsx (revision 0) +++ document/src/layout/Layout.jsx (revision a05de7d808822160773971b6f868b9446346c9be) @@ -0,0 +1,17 @@ +import HeaderMenu from '@/layout/HeaderMenu' +import HeaderMenuComponents from '@/layout/HeaderMenu.component' +import { Outlet } from 'react-router-dom' + +function Layout() { + return ( +
+ +
+ + +
+
+ ) +} + +export default Layout \ No newline at end of file Index: document/src/main.jsx =================================================================== diff -u -r93189d7b02c2b27640f81219ac466c32fe868de1 -ra05de7d808822160773971b6f868b9446346c9be --- document/src/main.jsx (.../main.jsx) (revision 93189d7b02c2b27640f81219ac466c32fe868de1) +++ document/src/main.jsx (.../main.jsx) (revision a05de7d808822160773971b6f868b9446346c9be) @@ -1,9 +1,13 @@ -import React from 'react' +import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import App from '@/App'; +import { BrowserRouter } from 'react-router-dom' createRoot(document.getElementById('root')).render( - - - , + + {/* -- React-Router-dom -- BrowserRouter : URL 변경 시 렌더링할 컴포넌트 */} + + + + , ) Index: document/src/pages/Dashboard.jsx =================================================================== diff -u -r93189d7b02c2b27640f81219ac466c32fe868de1 -ra05de7d808822160773971b6f868b9446346c9be --- document/src/pages/Dashboard.jsx (.../Dashboard.jsx) (revision 93189d7b02c2b27640f81219ac466c32fe868de1) +++ document/src/pages/Dashboard.jsx (.../Dashboard.jsx) (revision a05de7d808822160773971b6f868b9446346c9be) @@ -1,47 +1,8 @@ -import { Link } from 'react-router-dom'; -import { - MonitorDown, - CircleUser, - Home, - LineChart, - Menu, - Package, - Package2, - Search, - ShoppingCart, - Users, - Settings, - PackagePlus, - BookHeart, - Loader , -} from "lucide-react" - -import { Badge } from "@/components/shadcn/ui/badge" -import { Button } from "@/components/shadcn/ui/button" -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/shadcn/ui/card" -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@/components/shadcn/ui/dropdown-menu" -import { Input } from "@/components/shadcn/ui/input" -import { Sheet, SheetContent, SheetTrigger } from "@/components/shadcn/ui/sheet" -import ModeToggle from '@/components/shadcn/mode-toggle' - -import axios from 'axios' import { useEffect, useState } from 'react' +import { Loader } from "lucide-react" +import axios from 'axios' import parse from 'html-react-parser' // html -> jsx 테스트 - function Dashboard() { const [htmlContent, setHtmlContent] = useState(null); const [loading, setLoading] = useState(true); @@ -50,186 +11,38 @@ axios.get('/api/&wr_id=16') .then(res => { const htmlString = res.data - setHtmlContent(parse(htmlString)) + setHtmlContent(parse(htmlString, { + replace: (domNode) => { + if (domNode.name === "img") { + return console.log(e)} /> + // onError={e => e.baseURI = 'http://313.co.kr'} />; + } + if (domNode.name === "div" && domNode.className === "loader") { + return
; + } + if (domNode.id === 'topicon') { + return
+ } + }, + })) }) .catch(err => console.log(err)) .finally(() => setLoading(false)); // 데이터 로드 완료 후 로딩 상태 업데이트 }, []); return ( - -
-
-
-
- - 313 DEV GRP - -
-
- -
-
-
-
-
- - - - - - -
- - - Upgrade to Pro - - Unlock all features and get unlimited access to our - support team. - - - - - - -
-
-
-
-
-
- - -
-
-
- - - - - - My Account - - Settings - Support - - Logout - - - -
- {/* 테스트 */} + <> + {/* 테스트 */} {loading ? (
) : ( htmlContent )} -
-
+ ) } Index: document/vite.config.js =================================================================== diff -u -r93189d7b02c2b27640f81219ac466c32fe868de1 -ra05de7d808822160773971b6f868b9446346c9be --- document/vite.config.js (.../vite.config.js) (revision 93189d7b02c2b27640f81219ac466c32fe868de1) +++ document/vite.config.js (.../vite.config.js) (revision a05de7d808822160773971b6f868b9446346c9be) @@ -5,9 +5,11 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); +// const VITE_ASSET_URL = import.meta.env.VITE_ASSET_URL || ''; export default defineConfig({ plugins: [react()], + // base: import.meta.env.VITE_ASSET_URL, server: { proxy: { '/api': { @@ -16,6 +18,10 @@ rewrite: (path) => path.replace(/^\/api/, ''), }, }, + '/': { + target: 'http://313.co.kr/php/gnuboard5/bbs/board.php?bo_table=manual', + changeOrigin: true, + }, }, resolve: { alias: {