commit d6cf0a1914f3f25e30da6cc47ad0f48ca52d96ef Author: AntoninoP Date: Wed Jun 26 00:30:08 2024 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/index.html b/index.html new file mode 100644 index 0000000..0c589ec --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + + +
+ + + diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 0000000..8ae1d47 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,22 @@ +import React from 'react'; +import ServerCard from './components/serverCard/serverCard'; +import { ToastContainer } from 'react-toastify'; +import 'react-toastify/dist/ReactToastify.css'; +import styles from './App.module.scss'; + +const App = () => { + return ( + <> +
+
+ + + +
+
+ + + ); +}; + +export default App; diff --git a/src/App.module.scss b/src/App.module.scss new file mode 100644 index 0000000..86c6c1e --- /dev/null +++ b/src/App.module.scss @@ -0,0 +1,23 @@ +body, html { + background-color: #23272E; + margin: 0; + padding: 0; + height: 100%; +} + +.container { + min-height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} + +.cardsContainer { + width: 100%; + margin-top: 5rem; + display: flex; + flex-direction: column; + gap: 1rem; + align-items: center; + justify-content: center; +} diff --git a/src/assets/react.svg b/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/header/header.jsx b/src/components/header/header.jsx new file mode 100644 index 0000000..91c7b82 --- /dev/null +++ b/src/components/header/header.jsx @@ -0,0 +1,39 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +const Header = ({ height, bgColor, children, className }) => { + const headerStyle = { + height: height, + backgroundColor: bgColor, + width: 'calc(100% - var(--sidebar-width-left) - var(--sidebar-width-right))', + position: 'fixed', + top: 0, + left: 'var(--sidebar-width-left)', + zIndex: 1000, + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + padding: '0 1rem', + }; + + return ( +
+ {children} +
+ ); +}; + +Header.propTypes = { + height: PropTypes.string, + bgColor: PropTypes.string, + children: PropTypes.node, + className: PropTypes.string, +}; + +Header.defaultProps = { + height: 'var(--header-height)', + bgColor: '#f8f9fa', + className: '', +}; + +export default Header; diff --git a/src/components/header/header.scss b/src/components/header/header.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx new file mode 100644 index 0000000..5a1924d --- /dev/null +++ b/src/components/serverCard/serverCard.jsx @@ -0,0 +1,34 @@ +import React from 'react'; +import styles from './serverCard.module.scss'; + +const ServerCard = ({ color, status, version, link, name }) => { + const getStatusColor = () => { + switch (status) { + case 'En cours': + return 'green'; + case 'Démarrage': + return 'orange'; + case 'Hors ligne': + return 'gray'; + default: + return 'gray'; + } + }; + + return ( + +
+
+ + + +
{name}
+
+
{status}
+
+
Version: {version}
+
+ ); +}; + +export default ServerCard; diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss new file mode 100644 index 0000000..79937e2 --- /dev/null +++ b/src/components/serverCard/serverCard.module.scss @@ -0,0 +1,55 @@ +.serverCard { + width: 90%; + padding: 2.5rem; + border: 0.1rem solid #343947; + border-radius: 0.5rem; + text-decoration: none; + display: flex; + flex-direction: row; + align-items: center; + background-color: #1E2227; + color: white; +} + +.status { + display: flex; + align-items: center; +} + +.statusOuterDot { + width: 14px; + height: 14px; + border-radius: 50%; + background-color: gray; + display: flex; + align-items: center; + justify-content: center; + margin-right: 8px; +} + +.statusInnerDot { + width: 10px; + height: 10px; + border-radius: 50%; +} + +.name { + font-size: 1.5rem; +} + +.statusText { + font-size: 1rem; + margin-top: 0.5rem; +} + +.version { + font-size: 1.5rem; + margin-left: auto; +} + +.leftCard { + display: flex; + flex-direction: column; + align-items: start; + justify-content: center; +} diff --git a/src/components/sidebar/Sidebar.scss b/src/components/sidebar/Sidebar.scss new file mode 100644 index 0000000..c8797b2 --- /dev/null +++ b/src/components/sidebar/Sidebar.scss @@ -0,0 +1,14 @@ +/* src/components/Sidebar.scss */ +.sidebar { + position: fixed; + top: 0; + bottom: 0; +} + +.sidebar-left { + left: 0; +} + +.sidebar-right { + right: 0; +} diff --git a/src/components/sidebar/sidebar.jsx b/src/components/sidebar/sidebar.jsx new file mode 100644 index 0000000..e00b7a8 --- /dev/null +++ b/src/components/sidebar/sidebar.jsx @@ -0,0 +1,43 @@ +import React, { useEffect } from 'react'; +import PropTypes from 'prop-types'; + +const Sidebar = ({ size, color, position, className, children }) => { + useEffect(() => { + document.documentElement.style.setProperty( + `--sidebar-width-${position}`, `${size}rem` + ); + }, [size, position]); + + const sidebarStyle = { + width: `${size}rem`, + backgroundColor: color, + height: '100vh', + position: 'fixed', + top: 0, + [position]: 0, + overflowY: 'auto' + }; + + return ( +
+ {children} +
+ ); +}; + +Sidebar.propTypes = { + size: PropTypes.number, + color: PropTypes.string, + position: PropTypes.oneOf(['left', 'right']), + className: PropTypes.string, + children: PropTypes.node +}; + +Sidebar.defaultProps = { + size: 5, + color: '#f8f9fa', + position: 'left', + className: '' +}; + +export default Sidebar; diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..6119ad9 --- /dev/null +++ b/src/index.css @@ -0,0 +1,68 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/src/main.css b/src/main.css new file mode 100644 index 0000000..154cbeb --- /dev/null +++ b/src/main.css @@ -0,0 +1,4 @@ +html{ + font-size: 12px; +} + diff --git a/src/main.jsx b/src/main.jsx new file mode 100644 index 0000000..d64ebc7 --- /dev/null +++ b/src/main.jsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.jsx' +import './main.css' + +ReactDOM.createRoot(document.getElementById('root')).render( + + + , +)