Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
The-DevBlog committed Nov 12, 2023
1 parent 3bd8a8d commit 008b5a2
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 135 deletions.
17 changes: 17 additions & 0 deletions devblog/devblog/ClientApp/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import { useEffect, useState } from "react";
import { IsLoggedIn } from "../components/AuthenticationService";
import DeleteAccount from "./DeleteAccount";
import "./styles/Footer.css";



const Footer = () => {
const [userName, setUsername] = useState("");
const [loggedIn, setLoggedIn] = useState(false);

useEffect(() => {
setLoggedIn(IsLoggedIn);
setUsername(localStorage.getItem("userName")!);
}, []);

return (
<div className="footer">
<DeleteAccount />
{loggedIn &&
<span>
Welcome {userName}
</span>
}
</div>
)
}
Expand Down
57 changes: 17 additions & 40 deletions devblog/devblog/ClientApp/src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "./styles/Nav.css";

const Nav = () => {
const [loggedIn, setLoggedIn] = useState(false);
const [userName, setUsername] = useState("");
const [isMenuClicked, setIsMenuClicked] = useState(false)
const [display, setDisplay] = useState("none")
const [isAdmin, setIsAdmin] = useState(false);
Expand Down Expand Up @@ -38,59 +37,37 @@ const Nav = () => {

useEffect(() => {
setLoggedIn(IsLoggedIn);
setUsername(localStorage.getItem("userName")!);
}, []);

return (
<>
<nav className="navbar">
<Link className="logo-link" to="/">
<div className="logo">
<span>The</span>
<br />
<span>DevBlog</span>
<span>The DevBlog</span>
</div>
</Link>

<div className="nav-items">
<Link to="/" className={isActive("/")}>Home</Link>
<Link to="/posts" className={isActive("/posts")}>Posts</Link>
<Link to="/about" className={isActive("/about")}>About</Link>
{isAdmin && <Link to="/insights" className={isActive("/insights")}>Insights</Link>}
<div className="nav-drop-down">
<MdMenu className="nav-icon" onClick={updateMenu} size={69} />

{loggedIn ? (
<span className="accounts">
<SignOut />
<span>Welcome {userName}</span>
</span>
) : (
<span className="accounts">
<Link to="/signin" className={isActive("/signin")}>Login</Link>
<Link to="/signup" className={isActive("/signup")}>SignUp</Link>
</span>
)}
</div>
</nav >

<div className="mobile-nav">
<MdMenu className="mobile-nav-icon" onClick={updateMenu} size={75} />
<div className="nav-links" style={{ display: display }}>
<Link to="/" className={isActive("/")}>Home</Link>
<Link to="/posts" className={isActive("/posts")}>Posts</Link>
<Link to="/about" className={isActive("/about")}>About</Link>
{isAdmin && <Link to="/insights" className={isActive("/insights")}>Insights</Link>}

<div className="mobile-nav-links" style={{ display: display }}>
<Link to="/" className={isActive("/")}>Home</Link>
<Link to="/posts" className={isActive("/posts")}>Posts</Link>
<Link to="/about" className={isActive("/about")}>About</Link>
{isAdmin && <Link to="/insights" className={isActive("/insights")}>Insights</Link>}
{loggedIn && <SignOut />}

{loggedIn && <SignOut />}

{!loggedIn &&
<span className="mobile-nav-accounts">
<Link to="/signin" className={isActive("/signin")}>Login</Link>
<Link to="/signup" className={isActive("/signup")}>SignUp</Link>
</span>
}
{!loggedIn &&
<span className="nav-accounts">
<Link to="/signin" className={isActive("/signin")}>Login</Link>
<Link to="/signup" className={isActive("/signup")}>SignUp</Link>
</span>
}
</div>
</div>
</div>
</nav >
</>
);
}
Expand Down
15 changes: 13 additions & 2 deletions devblog/devblog/ClientApp/src/components/styles/Footer.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
.footer {
height: 50px;
height: 50;
width: 100vw;
bottom: 0;
left: 0;
position: fixed;
z-index: 10;
display: flex;
}

.footer button {
.footer button,
.footer>span {
padding: 5px;
margin: 10px;
}

.footer button {
height: fit-content;
}

.footer>span {
margin-left: auto;
margin-right: 20px;
}
136 changes: 48 additions & 88 deletions devblog/devblog/ClientApp/src/components/styles/Nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
z-index: 10;
}

.nav-items>a,
.logo-link,
.accounts,
.nav-items .accounts:last-child a {
.logo-link {
color: white;
font-size: 20px;
height: fit-content;
Expand All @@ -22,114 +19,77 @@

.logo {
font-size: 40px;
padding: 5px;
}

.nav-items {
display: flex;
width: 100%;
.non-active,
.accounts a {
opacity: 0.7;
}

.navbar a:hover,
.accounts a:hover {
opacity: 1.0;
}

.accounts {
margin: auto 20px 5px auto;
.nav-links,
.nav-icon {
display: none;
}

.nav-items>span:last-child {
.nav-drop-down {
display: flex;
margin-left: auto;
margin-right: 20px;
flex-direction: column;
right: 5px;
z-index: 20;
position: fixed;
background-color: rgb(26, 32, 41);
}

.nav-items>span:last-child a {
padding: 3px;
.nav-links a,
.nav-links form {
text-decoration: none;
padding-top: 5px;
}

s .navbar .nav-items a.active {
text-decoration: underline;
font-weight: bold;
.nav-links>a:hover {
opacity: 1.0;
}

.nav-items>a:nth-child(1) {
margin-left: 30px;
.nav-links a.active {
text-decoration: underline;
}

.nav-items>a:nth-child(1),
.nav-items>a:nth-child(2),
.nav-items>a:nth-child(3),
.nav-items>a:nth-child(4) {
margin-top: auto;
margin-bottom: 5px;
.nav-icon {
cursor: pointer;
display: flex;
margin-left: auto;
}

.non-active,
.accounts a {
opacity: 0.7;
.nav-links {
margin-left: auto;
padding: 10px;
flex-direction: column;
}

.navbar a:hover,
.accounts a:hover {
opacity: 1.0;
.nav-accounts {
display: flex;
flex-direction: column;
}

.mobile-nav-links,
.mobile-nav-icon {
display: none;
.logout-form {
width: fit-content;
}

.logout {
font-size: 16px;
padding: 0px;
}


@media (max-width: 800px) {
.mobile-nav {
display: flex;
margin-left: auto;
margin-right: 20px;
flex-direction: column;
top: 25px;
right: 5px;
z-index: 20;
position: fixed;
background-color: rgb(26, 32, 41);
}

.nav-items {
display: none;
}

.mobile-nav-links a,
.mobile-nav-links form {
text-decoration: none;
padding-top: 5px;
}

.mobile-nav-links>a:hover {
opacity: 1.0;
}

.mobile-nav-links a.active {
text-decoration: underline;
}

.mobile-nav-icon {
cursor: pointer;
display: flex;
margin-left: auto;
}

.mobile-nav-links {
margin-left: auto;
padding: 10px;
flex-direction: column;
}

.mobile-nav-accounts {
display: flex;
flex-direction: column;
}

.logout-form {
width: fit-content;
}

.logout {
font-size: 16px;
padding: 0px;
@media(max-width: 450px) {
.logo {
font-size: 30px;
}
}
3 changes: 1 addition & 2 deletions devblog/devblog/ClientApp/src/components/styles/Post.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

.post {
width: 90%;
margin-bottom: 5em;
border: .15em solid rgb(70, 68, 60);
margin-bottom: 1.5em;
border-radius: .5em;
padding: 1em;
}
Expand Down
2 changes: 1 addition & 1 deletion devblog/devblog/ClientApp/src/pages/styles/Posts.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
display: flex;
flex-direction: column;
justify-content: center;
margin: 150px 20px 0px 20px;
margin: 100px 20px 0px 20px;
}

.pager:first-child {
Expand Down
3 changes: 1 addition & 2 deletions devblog/devblog/ClientApp/src/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
}

.post {
border: 1px solid rgb(94, 94, 94);
background-color: #1a2029;
}

Expand All @@ -23,7 +22,7 @@
.comment,
textarea,
button {
border: 1px solid rgb(94, 94, 94);
border: #0d1116;
background-color: #0d1116;
color: white;
}
Expand Down

0 comments on commit 008b5a2

Please sign in to comment.