Skip to content
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

Learning filter #1210

Merged
merged 7 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style filters
  • Loading branch information
thisisjofrank committed Nov 29, 2024
commit d7105051196c578ba08941608f243a42a94ad6f7
83 changes: 48 additions & 35 deletions learn/_pages/LandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LearningList } from "../_components/LearningList.tsx";
import { sidebar } from "../tutorials/_data.ts";
import { TutorialIcon } from "../_components/TutorialIcon.tsx";
import { ExampleIcon } from "../_components/ExampleIcon.tsx";
import { VideoIcon } from "../_components/VideoIcon.tsx";

export default function LandingPage() {
const componentsPerSidebarItem = sidebar.map(
Expand All @@ -16,11 +19,10 @@ export default function LandingPage() {
return (
<main
id="content"
className="w-full px-8 mx-8 pt-6 mt-16 mb-20"
className="flex flex-col px-8 pt-6 md:pt-12 mt-4 md:items-center md:justify-center max-w-[1200px] mx-auto mb-48"
>
<div className="w-full mb-8 flex justify-between gap-8
max-w-screen-xl mx-auto">
<div className="max-w-prose">
<div className="w-full mb-6 max-w-screen-xl mx-auto hub-header">
<div className="max-w-prose mb-8">
<h1 className="text-2xl font-semibold sm:text-3xl md:text-4xl mb-3">
Learning hub
</h1>
Expand All @@ -30,46 +32,57 @@ export default function LandingPage() {
favorite tools.
</p>
</div>
<div className="mt-2 ml-5 border-l border-foreground-tertiary dark:border-background-tertiary py-4 pl-4">
<h2 className="text-lg font-semibold mb-2 whitespace-nowrap">
Filter by type
</h2>

<label for="example" className="block text-[13px]">
<input
type="checkbox"
id="example"
value="Examples"
className="mr-2"
checked
/>Examples
<h2 className="text-lg font-semibold mb-2 mt-2">
Filter by type:
</h2>
<div className=" mb-2 flex gap-8 flex-wrap">
<label for="example" className="mr-4 flex items-center">
<ExampleIcon color="#9d9d9d" />Examples:
<span className="switch">
<input
type="checkbox"
id="example"
value="Examples"
className="mr-2"
checked
/>
<span className="slider"></span>
</span>
</label>

<label for="tutorial" className="block text-[13px]">
<input
type="checkbox"
id="tutorial"
value="Tutorials"
className="mr-2"
checked
/>Tutorials
<label for="tutorial" className="mr-4 flex items-center">
<TutorialIcon color="#9d9d9d" />Tutorials:
<span className="switch">
<input
type="checkbox"
id="tutorial"
value="Tutorials"
className="mr-2"
checked
/>
<span className="slider"></span>
</span>
</label>

<label for="video" className="block text-[13px]">
<input
type="checkbox"
id="video"
value="Videos"
className="mr-2"
checked
/>Videos
<label for="video" className="mr-4 flex items-center">
<VideoIcon color="#9d9d9d" />Videos:
<span className="switch">
<input
type="checkbox"
id="video"
value="Videos"
className="mr-2"
checked
/>
<span className="slider"></span>
</span>
</label>
</div>
</div>
<div className="columns-1 sm:columns-2 lg:columns-3 gap-8">
<div className="columns-1 sm:columns-2 lg:columns-3 gap-8 mb-8">
{componentsPerSidebarItem}
</div>
<p class="max-w-prose mx-auto text-center">
<p class="max-w-prose mx-auto text-center pt-4 mt-3">
Need an example that isn't here? Or want to add one of your own?<br />
{" "}
We welcome contributions!{" "}
Expand Down
62 changes: 54 additions & 8 deletions overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,59 @@
@apply mb-6 !important;
}

.active:after {
background-color: rgb(1 183 128 / var(--tw-text-opacity, 1));
clip-path: polygon(0 0, 100% 0, 50% 100%);
content: "";
height: 0.4rem;
left: calc(50% - 0.4rem);
.hub-header {
border-bottom: 1px solid var(--borderColor-muted, var(--color-border-muted));
padding-bottom: 0.3em;
}

.switch {
position: relative;
width: 1.8rem;
height: 1rem;
display: block;
margin-left: 0.5rem;
}

.switch input {
opacity: 0;
width: 0;
height: 0;
}

.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
border-radius: 1rem;
}

.slider:before {
position: absolute;
top: -0.5rem;
width: 0.8rem;
content: "";
height: calc(1rem - 4px);
width: calc(1rem - 4px);
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 50%;
}

input:checked + .slider {
background-color: #2196F3;
}

input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
transform: translateX(calc(.8rem));
}