-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use styled components #30
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,142 @@ | ||
"use client" | ||
|
||
import { links } from "../siteConfig" | ||
import styled, { css } from "styled-components" | ||
|
||
const LogoImage = styled.img` | ||
border-radius: 0.25rem; | ||
width: 3rem; | ||
` | ||
|
||
const Anchor = styled.a<{ | ||
ghost?: boolean | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}>` | ||
display: inline-flex; | ||
justify-content: center; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixup the previous commit for the typo. Should we consider using JS instead of the string template in order for type checking to help us with typos? |
||
align-items: center; | ||
|
||
font-size: 0.875rem; | ||
text-align: center; | ||
border-radius: 0.5rem; | ||
transition: background 200ms ease-in-out; | ||
|
||
color: #a7adba; | ||
|
||
height: 3rem; | ||
padding: 0 1rem; | ||
font-weight: 600; | ||
line-height: 1em; | ||
|
||
${(props) => { | ||
const backgroundColor = props.ghost ? "transparent" : "#1a1e23" | ||
|
||
return css` | ||
background: ${backgroundColor}; | ||
border: 1px solid ${backgroundColor}; | ||
` | ||
}} | ||
|
||
&:hover { | ||
${(props) => { | ||
if (props.ghost) | ||
return css` | ||
background: color-mix(in srgb, white 5%, transparent 100%); | ||
border: 1px solid transparent; | ||
` | ||
else | ||
return css` | ||
background: #15181d; | ||
border: 1px solid #15181d; | ||
` | ||
}} | ||
} | ||
Comment on lines
+30
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This all becomes simpler with no border. |
||
` | ||
|
||
const Button = styled.a<{ | ||
ghost?: boolean | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
}>` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
font-size: 0.875rem; | ||
text-align: center; | ||
border-radius: 0.5rem; | ||
transition: background 200ms ease-in-out; | ||
|
||
color: #a7adba; | ||
|
||
height: 3rem; | ||
padding: 0 1rem; | ||
font-weight: 600; | ||
line-height: 1em; | ||
|
||
${(props) => { | ||
const backgroundColor = props.ghost ? "transparent" : "#1a1e23" | ||
|
||
return css` | ||
background: ${backgroundColor}; | ||
border: 1px solid ${backgroundColor}; | ||
` | ||
}} | ||
|
||
&:hover { | ||
${(props) => { | ||
if (props.ghost) | ||
return css` | ||
background: color-mix(in srgb, white 5%, transparent 100%); | ||
border: 1px solid transparent; | ||
` | ||
else | ||
return css` | ||
background: #15181d; | ||
border: 1px solid #15181d; | ||
` | ||
}} | ||
} | ||
` | ||
|
||
const ImageAnchor = styled(Anchor)` | ||
padding: 0; | ||
` | ||
|
||
const NavLink = styled.a` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
font-size: 0.875rem; | ||
text-align: center; | ||
border-radius: 0.5rem; | ||
transition: background 200ms ease-in-out; | ||
|
||
color: #a7adba; | ||
|
||
padding: 0.5rem 1rem; | ||
line-height: 1.4em; | ||
|
||
background: transparent; | ||
border: 1px solid transparent; | ||
|
||
&:hover { | ||
background: color-mix(in srgb, white 5%, transparent 100%); | ||
border: 1px solid transparent; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the border is not using the same color function for its tweening? But perhaps the border should be removed anyway, but if not then this question is relevant. |
||
} | ||
` | ||
|
||
const DropdownButton = styled(Button)` | ||
@media (min-width: 1024px) { | ||
display: none; | ||
} | ||
` | ||
|
||
const Header = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like |
||
return ( | ||
<header> | ||
<nav className="navbar bg-base-100"> | ||
<div className="navbar-start"> | ||
<div className="dropdown"> | ||
<div tabIndex={0} role="button" className="btn btn-ghost lg:hidden"> | ||
<DropdownButton tabIndex={0} ghost> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
className="w-5 h-5" | ||
|
@@ -21,27 +151,25 @@ const Header = () => { | |
d="M4 6h16M4 12h8m-8 6h16" | ||
/> | ||
</svg> | ||
</div> | ||
</DropdownButton> | ||
<ul | ||
tabIndex={0} | ||
className="menu menu-lg dropdown-content bg-base-100 rounded-box z-[1] mt-3 w-52 p-2 shadow" | ||
> | ||
<NavLinks /> | ||
</ul> | ||
</div> | ||
<a className="inline p-0 btn btn-ghost" href="/"> | ||
<img src="/images/logo.jpeg" className="w-12 rounded" /> | ||
</a> | ||
<ImageAnchor ghost href="/"> | ||
<LogoImage src="/images/logo.jpeg" /> | ||
</ImageAnchor> | ||
</div> | ||
<div className="hidden navbar-center lg:flex"> | ||
<ul className="px-1 menu menu-horizontal"> | ||
<NavLinks /> | ||
</ul> | ||
</div> | ||
<div className="navbar-end"> | ||
<a className="btn" href={links.discord}> | ||
Join Us on Discord | ||
</a> | ||
<Anchor href={links.discord}>Join Us on Discord</Anchor> | ||
</div> | ||
</nav> | ||
</header> | ||
|
@@ -52,24 +180,20 @@ const NavLinks = () => { | |
return ( | ||
<> | ||
<li> | ||
<a href="/">Home</a> | ||
<NavLink href="/">Home</NavLink> | ||
</li> | ||
<li> | ||
<a href="/about">About</a> | ||
<NavLink href="/about">About</NavLink> | ||
</li> | ||
<li> | ||
<a target="_blank" href={links.lumaUrl}> | ||
<NavLink target="_blank" href={links.lumaUrl}> | ||
Event Calendar | ||
</a> | ||
</NavLink> | ||
</li> | ||
{/* Hide Events until the page design is ready and finalized */} | ||
{/* <li> | ||
<a href="/events">Events</a> | ||
</li> */} | ||
<li> | ||
<a target="_blank" href={links.talkSubmissionUrl}> | ||
<NavLink target="_blank" href={links.talkSubmissionUrl}> | ||
Give a Talk! | ||
</a> | ||
</NavLink> | ||
</li> | ||
</> | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put all local components below the exported. Priority should be: