-
Notifications
You must be signed in to change notification settings - Fork 0
added some more components, some styles, and some JavaScript. Currently at https://docs.astro.build/en/tutorial/4-layouts/1/ #4
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
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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| import '../styles/global.css'; | ||
| --- | ||
|
|
||
| <div class="hamburger"> | ||
| <span class="line"></span> | ||
| <span class="line"></span> | ||
| <span class="line"></span> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| import '../styles/global.css'; | ||
| import Hamburger from './Hamburger.astro'; | ||
| import Navigation from './Navigation.astro'; | ||
|
|
||
| --- | ||
|
|
||
| <header> | ||
| <nav> | ||
| <Hamburger /> | ||
| <Navigation /> | ||
| </nav> | ||
| </header> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import '../styles/global.css'; | |
| const { platform, username } = Astro.props; | ||
| --- | ||
|
|
||
| <a href={`https://www.${platform}.com/${username}`}>{platform}</a> | ||
| <a href={`https://www.${platform}.com/${username}`} target='_blank'>{platform}</a> | ||
|
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. Using |
||
|
|
||
| <style> | ||
| a { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| import '../styles/global.css'; | ||
| import Navigation from '../components/Navigation.astro'; | ||
| import Header from '../components/Header.astro'; | ||
| import Footer from '../components/Footer.astro'; | ||
|
|
||
| const pageTitle = "About Me"; | ||
|
|
@@ -44,7 +44,7 @@ const textCase = "uppercase" | |
| </style> | ||
| </head> | ||
| <body> | ||
| <Navigation /> | ||
| <Header /> | ||
| <h1>{pageTitle}</h1> | ||
| <h2>... and my new Astro site!</h2> | ||
|
|
||
|
|
@@ -71,5 +71,8 @@ const textCase = "uppercase" | |
|
|
||
| {goal === 3 ? <p>My goal is to finish in 3 days.</p> : <p>My goal is not 3 days.</p>} | ||
| <Footer /> | ||
| <script> | ||
| import '../scripts/menu.js'; | ||
| </script> | ||
|
Comment on lines
+74
to
+76
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. The menu script is currently imported on each page individually. To improve maintainability and adhere to the Don't Repeat Yourself (DRY) principle, consider creating a shared |
||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||||||||||||||||||||||||
| document.querySelector('.hamburger').addEventListener('click', () => { | ||||||||||||||||||||||||||||
| document.querySelector('.nav-links').classList.toggle('expanded'); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+3
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 script could be more robust and accessible.
Suggested change
|
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,4 +28,67 @@ body { | |||||
| h1 { | ||||||
| margin: 1rem 0; | ||||||
| font-size: 2.5rem; | ||||||
| } | ||||||
|
|
||||||
| /* nav styles */ | ||||||
|
|
||||||
| .hamburger { | ||||||
| padding-right: 20px; | ||||||
| cursor: pointer; | ||||||
| } | ||||||
|
|
||||||
| .hamburger .line { | ||||||
| display: block; | ||||||
| width: 40px; | ||||||
| height: 5px; | ||||||
| margin-bottom: 10px; | ||||||
| background-color: #ff9776; | ||||||
| } | ||||||
|
|
||||||
| .nav-links { | ||||||
| width: 100%; | ||||||
| top: 5rem; | ||||||
| left: 48px; | ||||||
| background-color: #ff9776; | ||||||
| display: none; | ||||||
| margin: 0; | ||||||
| } | ||||||
|
|
||||||
| .nav-links a { | ||||||
| display: block; | ||||||
| text-align: center; | ||||||
| padding: 10px 0; | ||||||
| text-decoration: none; | ||||||
| font-size: 1.2rem; | ||||||
| font-weight: bold; | ||||||
| text-transform: uppercase; | ||||||
| } | ||||||
|
|
||||||
| .nav-links a:hover, | ||||||
| .nav-links a:focus { | ||||||
| background-color: #ff9776; | ||||||
|
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. The
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| .expanded { | ||||||
| display: unset; | ||||||
| } | ||||||
|
|
||||||
| @media screen and (min-width: 636px) { | ||||||
| .nav-links { | ||||||
| margin-left: 5em; | ||||||
| display: block; | ||||||
| position: static; | ||||||
| width: auto; | ||||||
| background: none; | ||||||
| } | ||||||
|
|
||||||
| .nav-links a { | ||||||
| display: inline-block; | ||||||
| padding: 15px 20px; | ||||||
| } | ||||||
|
|
||||||
| .hamburger { | ||||||
| display: none; | ||||||
| } | ||||||
|
|
||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| { | ||
| "extends": "astro/tsconfigs/strict", | ||
| "include": [".astro/types.d.ts", "**/*"], | ||
| "exclude": ["dist"] | ||
| "exclude": ["dist"], | ||
| "compilerOptions": { | ||
| "lib": ["esnext", "dom"] | ||
| } | ||
| } |
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.
For accessibility, interactive elements like a menu toggle should be a
<button>instead of a<div>. This ensures it's keyboard-focusable and properly announced by screen readers. You should also include anaria-labelfor context andaria-expandedto indicate the menu's state (which should be toggled with JavaScript). Addingtype="button"is also a good practice to prevent default form submission behavior.