Skip to content

Commit 848d6c8

Browse files
committed
add
1 parent d2e0d69 commit 848d6c8

File tree

23 files changed

+2097
-1115
lines changed

23 files changed

+2097
-1115
lines changed

.github/workflows/nextjs.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2-
#
3-
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4-
#
51
name: Deploy Next.js site to Pages
62

73
on:

components/Header.js

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useState, useEffect } from 'react';
2-
import Link from 'next/link';
32
import { useRouter } from 'next/router';
43

54
export default function Header() {
@@ -9,6 +8,9 @@ export default function Header() {
98

109
// Check if the current route matches the link
1110
const isActive = (path) => {
11+
if (path === '/') {
12+
return router.pathname === path;
13+
}
1214
return router.pathname === path || router.pathname.startsWith(`${path}/`);
1315
};
1416

@@ -26,38 +28,38 @@ export default function Header() {
2628
<header className={`sticky top-0 z-50 bg-white ${isScrolled ? 'shadow-md' : 'shadow-sm'} transition-shadow duration-300`}>
2729
<div className="container mx-auto px-4 py-4">
2830
<div className="flex justify-between items-center">
29-
<Link href="/" className="flex items-center space-x-2 group">
31+
<a href="/" className="flex items-center space-x-2 group">
3032
<div className="w-10 h-10 bg-blue-600 rounded-lg flex items-center justify-center text-white font-bold text-xl group-hover:bg-blue-700 transition-colors">G</div>
3133
<div className="font-bold text-xl text-gray-800 group-hover:text-blue-600 transition-colors">GolangMastery</div>
32-
</Link>
34+
</a>
3335

3436
{/* Desktop Navigation */}
3537
<nav className="hidden md:flex items-center space-x-8">
36-
<Link href="/courses"
38+
<a href="/courses"
3739
className={`font-medium ${isActive('/courses')
3840
? 'text-blue-600'
3941
: 'text-gray-600 hover:text-blue-600'} transition-colors`}>
4042
Learn
41-
</Link>
42-
<Link href="/projects"
43+
</a>
44+
<a href="/projects"
4345
className={`font-medium ${isActive('/projects')
4446
? 'text-blue-600'
4547
: 'text-gray-600 hover:text-blue-600'} transition-colors`}>
4648
Projects
47-
</Link>
48-
<Link href="/pricing"
49+
</a>
50+
<a href="/pricing"
4951
className={`font-medium ${isActive('/pricing')
5052
? 'text-blue-600'
5153
: 'text-gray-600 hover:text-blue-600'} transition-colors`}>
5254
Pricing
53-
</Link>
55+
</a>
5456
<div className="flex items-center space-x-4 ml-4">
55-
<Link href="/login" className="text-gray-600 hover:text-blue-600 font-medium transition-colors">
57+
<a href="/login" className="text-gray-600 hover:text-blue-600 font-medium transition-colors">
5658
Log In
57-
</Link>
58-
<Link href="/register" className="bg-blue-600 text-white px-5 py-2 rounded-md hover:bg-blue-700 transition-colors font-medium shadow-sm hover:shadow">
59+
</a>
60+
<a href="/register" className="bg-blue-600 text-white px-5 py-2 rounded-md hover:bg-blue-700 transition-colors font-medium shadow-sm hover:shadow">
5961
Join For Free
60-
</Link>
62+
</a>
6163
</div>
6264
</nav>
6365

@@ -81,38 +83,38 @@ export default function Header() {
8183
<nav className="md:hidden mt-4 py-4 border-t border-gray-200">
8284
<ul className="space-y-4">
8385
<li>
84-
<Link href="/courses"
86+
<a href="/courses"
8587
className={`block font-medium ${isActive('/courses')
8688
? 'text-blue-600'
8789
: 'text-gray-600 hover:text-blue-600'} transition-colors`}>
8890
Learn
89-
</Link>
91+
</a>
9092
</li>
9193
<li>
92-
<Link href="/projects"
94+
<a href="/projects"
9395
className={`block font-medium ${isActive('/projects')
9496
? 'text-blue-600'
9597
: 'text-gray-600 hover:text-blue-600'} transition-colors`}>
9698
Projects
97-
</Link>
99+
</a>
98100
</li>
99101
<li>
100-
<Link href="/pricing"
102+
<a href="/pricing"
101103
className={`block font-medium ${isActive('/pricing')
102104
? 'text-blue-600'
103105
: 'text-gray-600 hover:text-blue-600'} transition-colors`}>
104106
Pricing
105-
</Link>
107+
</a>
106108
</li>
107109
<li className="pt-4 border-t border-gray-100">
108-
<Link href="/login" className="block text-gray-600 hover:text-blue-600 font-medium transition-colors">
110+
<a href="/login" className="block text-gray-600 hover:text-blue-600 font-medium transition-colors">
109111
Log In
110-
</Link>
112+
</a>
111113
</li>
112114
<li className="pt-2">
113-
<Link href="/register" className="block bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition-colors font-medium text-center shadow-sm">
115+
<a href="/register" className="block bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 transition-colors font-medium text-center shadow-sm">
114116
Join For Free
115-
</Link>
117+
</a>
116118
</li>
117119
</ul>
118120
</nav>

components/MDXComponents.js

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const TableOfContents = ({ headings }) => {
268268
<ul className="space-y-2">
269269
{headings.map((heading, index) => (
270270
<li key={index} className={`${heading.level > 2 ? 'ml-4' : ''}`}>
271-
<a
271+
<Link
272272
href={`#${heading.id}`}
273273
className={`text-blue-600 hover:text-blue-800 hover:underline flex items-center ${
274274
heading.level === 2 ? 'font-medium' : ''
@@ -286,7 +286,7 @@ const TableOfContents = ({ headings }) => {
286286
)}
287287
</span>
288288
{heading.text}
289-
</a>
289+
</Link>
290290
</li>
291291
))}
292292
</ul>
@@ -308,15 +308,24 @@ const createHeadingWithAnchor = (level, className) => {
308308
},
309309
<>
310310
{props.children}
311-
<a
312-
href={`#${id}`}
311+
<button
312+
onClick={() => {
313+
// Create a URL object to get the pathname without query params
314+
const url = new URL(window.location.href);
315+
// Update the hash
316+
url.hash = id;
317+
// Update browser history
318+
window.history.pushState({}, '', url.toString());
319+
// Copy to clipboard
320+
navigator.clipboard.writeText(url.toString());
321+
}}
313322
className="ml-2 text-gray-400 opacity-0 hover:opacity-100 group-hover:opacity-70 transition-opacity duration-200"
314-
aria-label={`Link to ${props.children}`}
323+
aria-label={`Copy link to ${props.children}`}
315324
>
316325
<svg className="w-4 h-4 inline" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
317326
<path fillRule="evenodd" d="M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z" clipRule="evenodd" />
318327
</svg>
319-
</a>
328+
</button>
320329
</>
321330
);
322331
};
@@ -332,27 +341,24 @@ const MDXComponents = {
332341
<p className="my-4 text-gray-700 leading-relaxed text-lg" {...props} />
333342
),
334343

335-
a: props => {
336-
// Check if it's an external link
337-
const isExternal = props.href?.startsWith('http') || props.href?.startsWith('https');
344+
a: ({ href, children, ...props }) => {
345+
if (href && href.startsWith('/')) {
346+
return (
347+
<Link href={href} className="text-blue-600 hover:text-blue-800 underline" {...props}>
348+
{children}
349+
</Link>
350+
);
351+
}
338352

339-
return (
340-
<Link href={props.href || '#'}>
341-
<a
342-
className="text-blue-600 hover:text-blue-800 font-medium transition-colors duration-200 border-b border-blue-200 hover:border-blue-500"
343-
target={isExternal ? "_blank" : undefined}
344-
rel={isExternal ? "noopener noreferrer" : undefined}
345-
{...props}
346-
>
347-
{props.children}
348-
{isExternal && (
349-
<svg className="w-3.5 h-3.5 inline-block ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
350-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
351-
</svg>
352-
)}
353+
if (href && (href.startsWith('http') || href.startsWith('mailto:'))) {
354+
return (
355+
<a href={href} target="_blank" rel="noopener noreferrer" className="text-blue-600 hover:text-blue-800 underline" {...props}>
356+
{children}
353357
</a>
354-
</Link>
355-
);
358+
);
359+
}
360+
361+
return <a href={href} className="text-blue-600 hover:text-blue-800 underline" {...props}>{children}</a>;
356362
},
357363

358364
ul: props => (
Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Quick Start with Golang
3-
description: Master Golang fundamentals in this hands-on course designed for beginners. Learn essential concepts like data types, control structures, functions, packages, and data structures.
2+
title: "Quick Start with Golang"
3+
description: "Master Golang fundamentals in this hands-on course designed for beginners. Learn essential concepts like data types, control structures, functions, packages, and data structures through interactive labs and practical challenges."
44
coverImage: /images/courses/quick-start-with-golang.png
5-
level: Beginner
6-
tags: [Go, Programming]
5+
level: "Beginner"
6+
tags: ["Go", "Programming"]
77
labs:
88
- title: Setting up Go Environment
99
slug: setup-go-environment
@@ -18,29 +18,49 @@ labs:
1818

1919
# Quick Start with Golang
2020

21-
Welcome to the Quick Start with Golang course! This course is designed to help you learn the fundamentals of the Go programming language.
21+
Welcome to the **Quick Start with Golang** course! This course is designed to help you quickly get up to speed with Go programming.
2222

2323
## What You'll Learn
2424

25-
- Setting up your Go development environment
26-
- Basic syntax and data types
27-
- Control structures
25+
- Go syntax and basic concepts
26+
- Variables, types, and control structures
2827
- Functions and packages
29-
- Basic data structures
3028
- Error handling
31-
- Testing in Go
29+
- Concurrency basics
3230

3331
## Prerequisites
3432

3533
This course assumes no prior knowledge of Go. However, basic programming experience in any language will be helpful.
3634

3735
## Course Structure
3836

39-
This course consists of 10 interactive labs. Each lab includes:
37+
This course is divided into several sections, each focusing on a specific aspect of Go programming.
4038

41-
1. Theory and explanations
42-
2. Code examples
43-
3. Interactive exercises
44-
4. Quizzes to test your understanding
39+
### Section 1: Setting Up Your Environment
4540

46-
Let's get started with your Go journey!
41+
Before we dive into coding, you'll need to set up your development environment:
42+
43+
1. Install Go from the [official website](https://golang.org/dl/)
44+
2. Set up your workspace
45+
3. Configure your IDE
46+
47+
### Section 2: Go Fundamentals
48+
49+
```go
50+
package main
51+
52+
import "fmt"
53+
54+
func main() {
55+
fmt.Println("Hello, Gophers!")
56+
}
57+
```
58+
59+
In this section, you'll learn about:
60+
61+
- Basic syntax
62+
- Variables and constants
63+
- Data types
64+
- Operators
65+
66+
Ready to get started? Let's dive in!

0 commit comments

Comments
 (0)