Skip to content

Commit

Permalink
use challenges page for home
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian-Pob committed Mar 1, 2024
1 parent 8361ce0 commit 039319b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
10 changes: 4 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { A, Navigate, Route, Router, Routes } from '@solidjs/router';
import { Route, Router, Routes } from '@solidjs/router';
import type { Component } from 'solid-js';
import * as c from './Challenges';
import { Challenges, Home } from './Pages';
import { Footer, Navbar } from './components';
import { Challenges } from './Pages';
import { Navbar } from './components';
const App: Component = () => {
return (
<>
<Router>
<Navbar />
<Routes>
<Route path="/" element={<Home />}></Route>
<Route path="/" element={<Challenges />}></Route>
<Route path="/Challenges">
<Route path="/" element={<Challenges />} />
<Route path="/OrderSummaryComponent" element={<c.OrderSummaryComponent />} />
Expand All @@ -20,8 +20,6 @@ const App: Component = () => {
<Route path="/TestimonialsGrid" element={<c.TestimonialsGrid />} />
<Route path="/Calculator" element={<c.Calculator />} />

{/* Paths below are hosted on a different site*/}
<Route path="/ArticlePreviewComponent" element={<c.Redirector />} />
</Route>
</Routes>
</Router>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChallengeCard/ChallengeCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
overflow: hidden;

& img {
max-width: 100%;
width: 100%;
max-height: 100%;
object-fit: cover;
}
Expand Down
10 changes: 2 additions & 8 deletions src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Location } from '@solidjs/router';
import { A, AnchorProps, useLocation, useNavigate } from '@solidjs/router';
import s from './Navbar.module.css';

Expand All @@ -7,15 +6,10 @@ export function Link(props: AnchorProps) {
return <A state={{ previous: location.pathname }} {...props} />;
}

class LocationState extends Location {
previous?: string;
}

// Credit for Navigate Back solution:
// https://github.com/solidjs/solid-router/discussions/231
export function BackButton({ text }: { text?: string }) {
const navigate = useNavigate();
const location = useLocation<LocationState>();

// Credit for solution:
// https://bobbyhadz.com/blog/typescript-no-overload-matches-this-call
Expand All @@ -31,14 +25,14 @@ const Navbar = () => {
return (
<nav class={s.header}>
<BackButton text="Back" />
<div class={s.links}>
{/* <div class={s.links}>
<Link href="/" class={s['header-link']}>
Home
</Link>
<Link href="/challenges" class={s['header-link']}>
Completed Challenges
</Link>
</div>
</div> */}
</nav>
);
};
Expand Down

0 comments on commit 039319b

Please sign in to comment.