From b4eefb95ac12c2d398f9c7635ea23d42579ccf16 Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Thu, 11 Jul 2024 17:47:23 +0200 Subject: [PATCH] fix css et factorisation html --- src/components/CreateServer/CreateServer.jsx | 115 +++++++++--------- .../CreateServer/CreateServer.module.scss | 103 +++++++++++++--- src/pages/DashboardPage/DashboardPage.jsx | 12 +- src/pages/NoServer/NoServer.jsx | 27 ---- src/pages/NoServer/NoServer.module.scss | 44 ------- 5 files changed, 154 insertions(+), 147 deletions(-) delete mode 100644 src/pages/NoServer/NoServer.jsx delete mode 100644 src/pages/NoServer/NoServer.module.scss diff --git a/src/components/CreateServer/CreateServer.jsx b/src/components/CreateServer/CreateServer.jsx index 8e9c17e..2bdd9a6 100644 --- a/src/components/CreateServer/CreateServer.jsx +++ b/src/components/CreateServer/CreateServer.jsx @@ -3,7 +3,7 @@ import styles from './CreateServer.module.scss'; import { getUserSubdomain } from "../../service/firebase"; import serviiApi from "../../service/api.tsx"; -const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel }) => { +const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noServers }) => { const [subdomain, setSubdomain] = useState(null); const [subdomainInput, setSubdomainInput] = useState(''); const [serverName, setServerName] = useState(''); @@ -45,70 +45,71 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel }) => } }; - if (subdomain === null) { - return ( -
-
Loading...
-
- ); - } - return ( - <> - {subdomain === '' ? ( -
-
-
Ecrivez votre sous domaine
-
- Le sous-domaine est le nom sous lequel vos amis et vous rejoignez le serveur, un peu comme une adresse. Choisissez-le bien, car il n'est pas facilement modifiable ! -
- setSubdomainInput(e.target.value)} - /> - - -
+
+ {noServers ? ( +
+
Erreur
+
Aucun serveur
+
) : ( -
-
-
Création du serveur
- setServerName(e.target.value)} - /> - -
- -
-
-
+ ) : ( +
+
Création du serveur
+ setServerName(e.target.value)} + /> + +
+ + +
+
+ ) + ) )} - +
); }; diff --git a/src/components/CreateServer/CreateServer.module.scss b/src/components/CreateServer/CreateServer.module.scss index d13e2eb..7f77d82 100644 --- a/src/components/CreateServer/CreateServer.module.scss +++ b/src/components/CreateServer/CreateServer.module.scss @@ -1,20 +1,10 @@ -.container { - display: flex; - justify-content: center; - align-items: center; - width: 100%; -} - -.mainCard, .mainCardSubdomain { +.mainCardCommon { display: flex; justify-content: start; align-items: start; flex-direction: column; - width: 75rem; background-color: #1D1836; border-radius: 1.5rem; - padding: 4rem; - margin-top: 5rem; } .title { @@ -33,7 +23,7 @@ } .input, .select { - width: 100%; + width: 60rem; padding: 1rem; margin-top: 1rem; background-color: #090325; @@ -56,7 +46,90 @@ margin-right: 1rem; } -.btnSubCreate:hover, .btnServCreate:hover { - background-color: #120a8f; - transform: scale(1.05); + +.containerNoserveur { + display: flex; + justify-content: center; + align-items: center; } + +.mainCardNoserveur { + background-color: #1D1836; + padding: 3rem; + margin-top: 5rem; + border-radius: 1rem; +} + +.nsTitle { + font-size: 3rem; + color: #F2F2F2; + font-weight: 900; +} + +.nsSubTitle { + font-size: 1.8rem; + color: #AAA6C3; + font-weight: 300; +} + +.btnnoServCreate { + width: 40rem; + height: 5rem; + margin-top: 5rem; + font-size: 2rem; + font-weight: 900; + background-color: #090325; + border-radius: 1rem; + color: white; + border: none; + cursor: pointer; +} + +.btnServCreate{ + width: 15rem; + height: 3.5rem; + margin-top: 2.5rem; + font-size: 1.5rem; + font-weight: 900; + border-radius: 1rem; + background-color: #090325; + +} + +.mainCardCreateServ{ + margin-top: 5rem; + display: flex; + justify-content: center; + align-items: start; + flex-direction: column; + background-color: #1D1836; + border-radius: 1rem; + padding: 2rem; +} + +.mainCardSubdomain{ + background-color: #1D1836; + padding: 3rem; + margin-top: 5rem; + border-radius: 1rem; + width: 55rem; +} + +.subtitle{ + font-size: 1.2rem; + color: #AAA6C3; + font-weight: 600; + text-align: start; + margin-bottom: 2rem; +} + +.inputsubdomain{ + width: 50rem; + padding: 1rem; + margin-top: 1rem; + background-color: #090325; + border: none; + border-radius: 0.5rem; + color: white; + font-size: 1rem; +} \ No newline at end of file diff --git a/src/pages/DashboardPage/DashboardPage.jsx b/src/pages/DashboardPage/DashboardPage.jsx index 12022f1..b055eb3 100644 --- a/src/pages/DashboardPage/DashboardPage.jsx +++ b/src/pages/DashboardPage/DashboardPage.jsx @@ -2,11 +2,10 @@ import React, { useEffect, useState } from 'react'; import ServerCard from '../../components/serverCard/serverCard'; import Navbar from '../../components/navbar/Navbar'; import styles from './DashboardPage.module.scss'; -import NoServer from '../NoServer/NoServer'; -import { getUserSubdomain } from "../../service/firebase"; -import serviiApi from "../../service/api.tsx"; import Loading from '../Loading/loading'; import CreateServer from '../../components/CreateServer/CreateServer'; +import { getUserSubdomain } from "../../service/firebase"; +import serviiApi from "../../service/api.tsx"; const DashboardPage = ({ user }) => { const [servers, setServers] = useState([]); @@ -89,6 +88,7 @@ const DashboardPage = ({ user }) => { const address = `${subdomain}.servii.fr`; navigator.clipboard.writeText(address) .then(() => { + console.log('Address copied to clipboard'); }) }; @@ -114,7 +114,11 @@ const DashboardPage = ({ user }) => { ) : (
{servers.length === 0 ? ( - + ) : (
diff --git a/src/pages/NoServer/NoServer.jsx b/src/pages/NoServer/NoServer.jsx deleted file mode 100644 index be33ef7..0000000 --- a/src/pages/NoServer/NoServer.jsx +++ /dev/null @@ -1,27 +0,0 @@ -import React, { useState } from 'react'; -import styles from './NoServer.module.scss'; -import CreateServer from '../../components/CreateServer/CreateServer'; - -const NoServer = ({ user, onCreateServer }) => { - const [isCreating, setIsCreating] = useState(false); - - return ( -
-
- {isCreating === false ? ( - <> -
Erreur
-
Aucun serveur possédé
- - - ) : ( - <> - - - )} -
-
- ); -}; - -export default NoServer; diff --git a/src/pages/NoServer/NoServer.module.scss b/src/pages/NoServer/NoServer.module.scss deleted file mode 100644 index 220b50d..0000000 --- a/src/pages/NoServer/NoServer.module.scss +++ /dev/null @@ -1,44 +0,0 @@ -.container{ - display: flex; - justify-content: center; - align-items: center; - width: 100%; -} - -.mainCard{ - display: flex; - justify-content: start; - align-items: start; - flex-direction: column; - width: 75rem; - background-color: #1D1836; - border-radius: 1.5rem; -} - -.nsTitle{ - font-size: 3.5rem; - color: #F2F2F2; - font-weight: 900; -} - -.nsSubTitle{ - font-size: 1.8rem; - color: #AAA6C3; - font-weight: 300; -} - -.btnServCreate{ - display: flex; - justify-content: center; - align-items: center; - background-color: #090325; - width: 40rem; - height: 5rem; - color: white; - margin-top: 5rem; - border: solid 0.1rem #090325; - cursor: pointer; - font-size: 2rem; - font-weight: 900; - border-radius: 1rem; -} \ No newline at end of file