-
Notifications
You must be signed in to change notification settings - Fork 0
7 make page explore plants #27
Merged
+439
−6
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9a9ca45
create ExplorePage.tsx and .css files
helenul 2a3e8dc
add routing for ExplorePage
helenul 83ba225
add styling to the Explore page and add possibility to filter with mo…
helenul 783e0b2
add translation to the Explore page
helenul 6c94323
add debounce for search functionality and message for no results
helenul f71c35f
run lint, install and run prettier
helenul dcaa689
add extra filters and reset button for filters and search
helenul 2823828
fix better explore page for mobile use
helenul 2ee1ad8
remove excess styling for explore page
helenul a1b8328
add function to plant-card placeholder to show information about the …
helenul 9a0c796
fix reset button for search and filtering
helenul 9f03356
add hook for sessionStorage
helenul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { useEffect, useState } from "react"; | ||
|
|
||
| export function useDebounce<T>(value: T, delay = 800): T { | ||
| const [debouncedValue, setDebouncedValue] = useState(value); | ||
|
|
||
| useEffect(() => { | ||
| const timer = setTimeout(() => setDebouncedValue(value), delay); | ||
|
|
||
| return () => clearTimeout(timer); | ||
| }, [value, delay]); | ||
|
|
||
| return debouncedValue; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { useEffect, useState } from "react"; | ||
|
|
||
| export function useSessionState(key: string, initialValue = "") { | ||
| const [value, setValue] = useState<string>(() => { | ||
| try { | ||
| return sessionStorage.getItem(key) ?? initialValue; | ||
| } catch { | ||
| return initialValue; | ||
| } | ||
| }); | ||
|
|
||
| useEffect(() => { | ||
| try { | ||
| sessionStorage.setItem(key, value); | ||
| } catch { | ||
| // Storage can fail (private mode, full quota). The app still works, | ||
| // the value just won't be remembered. | ||
| } | ||
| }, [key, value]); | ||
|
|
||
| return [value, setValue] as const; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| .explore-page { | ||
| margin-left: var(--sidebar-width); | ||
| width: calc(100% - var(--sidebar-width)); | ||
| min-height: 100vh; | ||
| padding: 40px; | ||
| box-sizing: border-box; | ||
|
|
||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| gap: 30px; | ||
|
|
||
| font-family: Georgia, serif; | ||
| } | ||
|
|
||
| .visually-hidden { | ||
| position: absolute; | ||
| width: 1px; | ||
| height: 1px; | ||
| overflow: hidden; | ||
| clip: rect(0 0 0 0); | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .explore-form, | ||
| .plant-grid { | ||
| width: 100%; | ||
| } | ||
|
|
||
| .explore-search input { | ||
| width: 100%; | ||
| padding: 0.75rem 1rem; | ||
| font-size: 1rem; | ||
| border: 1px solid var(--border-soft); | ||
| border-radius: 8px; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| .explore-search input:focus { | ||
| outline: none; | ||
| border-color: var(--dark-green); | ||
| box-shadow: 0 0 0 2px var(--dark-green); | ||
| } | ||
|
|
||
| .explore-filters { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 1rem; | ||
| margin: 1rem 0 0; | ||
| padding: 0; | ||
| border: 0; | ||
| } | ||
|
|
||
| .filter { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.25rem; | ||
| } | ||
|
|
||
| .filter select { | ||
| padding: 0.5rem; | ||
| border: 1px solid var(--border-soft); | ||
| border-radius: 8px; | ||
| min-width: 160px; | ||
| } | ||
|
|
||
| .filter select:focus { | ||
| outline: none; | ||
| border-color: var(--dark-green); | ||
| box-shadow: 0 0 0 2px var(--dark-green); | ||
| } | ||
|
|
||
| .reset-button { | ||
| align-self: flex-start; | ||
| width: 74px; | ||
| height: 38px; | ||
| border: 1px solid var(--border-soft); | ||
| border-radius: 8px; | ||
| background-color: var(--light-green); | ||
| color: var(--text-dark); | ||
| font-size: 16px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .reset-button:hover { | ||
| background-color: var(--dark-green); | ||
| color: var(--text-light); | ||
| } | ||
|
|
||
| .reset-button:focus-within { | ||
| outline: none; | ||
| border: var(--dark-green); | ||
| box-shadow: 0 0 0 2px var(--dark-green); | ||
| } | ||
|
|
||
| .plant-grid { | ||
| list-style: none; | ||
| margin: 0; | ||
| padding: 0; | ||
| display: grid; | ||
| grid-template-columns: repeat(4, 1fr); | ||
| gap: 20px; | ||
| } | ||
|
|
||
| .explore-plant-card-placeholder { | ||
| aspect-ratio: 3 / 4; | ||
| border-radius: 12px; | ||
| overflow: hidden; | ||
| box-sizing: border-box; | ||
| border: 3px solid var(--border-soft); | ||
| } | ||
|
|
||
| .explore-plant-card-placeholder:focus-within { | ||
| border-color: var(--dark-green); | ||
| } | ||
|
|
||
| .plant-card-button { | ||
| width: 100%; | ||
| height: 100%; | ||
| padding: 1rem; | ||
| text-align: center; | ||
| background: none; | ||
| border: none; | ||
| outline: none; | ||
| font: inherit; | ||
| color: inherit; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .plant-card-info { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.75rem; | ||
| text-align: left; | ||
| } | ||
|
|
||
| @media (max-width: 767px) { | ||
| .explore-page { | ||
| margin-left: 0; | ||
| width: 100%; | ||
| padding: 20px; | ||
| gap: 20px; | ||
| } | ||
|
|
||
| .plant-grid { | ||
| grid-template-columns: repeat(2, 1fr); | ||
| gap: 15px; | ||
| } | ||
|
|
||
| .plant-card-button { | ||
| padding: 0.5rem; | ||
| } | ||
|
|
||
| .plant-card-info { | ||
| font-size: 13px; | ||
| gap: 0.4rem; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.