Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GrowBros
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tomato
GrowBros
Commits
558e740b
Commit
558e740b
authored
1 year ago
by
Holzheu Hannah
Browse files
Options
Downloads
Patches
Plain Diff
added FilterPage with sliders and DropDownFilters for search Requests
#13
parent
ee50f07d
No related branches found
No related tags found
1 merge request
!28
Closes #40 : Custom useGrowbrosFetcher hook to make calls to the backend.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
growbros-frontend/src/components/DropDownFilter.tsx
+34
-0
34 additions, 0 deletions
growbros-frontend/src/components/DropDownFilter.tsx
growbros-frontend/src/components/FilterPage.tsx
+58
-21
58 additions, 21 deletions
growbros-frontend/src/components/FilterPage.tsx
with
92 additions
and
21 deletions
growbros-frontend/src/components/DropDownFilter.tsx
+
34
−
0
View file @
558e740b
import
{
useState
}
from
"
react
"
;
function
DropDownFilter
(
props
:
PropsDropDownFilter
)
{
const
options
=
props
.
options
;
const
topic
=
props
.
topic
;
const
[
selectedOption
,
setSelectedOption
]
=
useState
(
""
);
const
handleOptionChange
=
(
event
:
any
)
=>
{
setSelectedOption
(
event
.
target
.
value
);
};
return
(
<
div
>
<
label
>
{
topic
}
</
label
>
<
select
value
=
{
selectedOption
}
onChange
=
{
handleOptionChange
}
>
<
option
value
=
""
></
option
>
{
options
.
map
((
option
,
index
)
=>
(
<
option
key
=
{
index
}
value
=
{
option
}
>
{
option
}
</
option
>
))
}
</
select
>
</
div
>
);
}
type
PropsDropDownFilter
=
{
options
:
Array
<
string
>
;
topic
:
string
;
};
export
default
DropDownFilter
This diff is collapsed.
Click to expand it.
growbros-frontend/src/components/FilterPage.tsx
+
58
−
21
View file @
558e740b
import
{
useState
}
from
"
react
"
;
import
Slider
from
"
rc-slider
"
;
import
"
rc-slider/assets/index.css
"
;
import
"
../stylesheets/FilterPage.css
"
;
import
DropDownFilter
from
"
./DropDownFilter
"
;
function
FilterPage
()
{
return
(
<
div
className
=
"filterPage"
>
<
h3
>
Setze Filter und suche nach passenden Pflanzen
</
h3
>
</
div
>
<>
<
div
className
=
"filterPage"
>
<
h3
>
Setze Filter und suche nach passenden Pflanzen
</
h3
>
</
div
>
<
div
>
<
DropDownFilter
topic
=
{
"
Wasserbedarf
"
}
options
=
{
[
"
Trocken
"
,
"
Feucht
"
,
"
Sehr Feucht
"
]
}
/>
<
DropDownFilter
topic
=
{
"
Nährstoffbedarf
"
}
options
=
{
[
"
Niedrig
"
,
"
Mittel
"
,
"
Hoch
"
]
}
/>
<
DropDownFilter
topic
=
{
"
Lichtbedarf
"
}
options
=
{
[
"
Niedrig
"
,
"
Mittel
"
,
"
Hoch
"
]
}
/>
<
DropDownFilter
topic
=
{
"
Bodentyp
"
}
options
=
{
[
"
Leicht
"
,
"
Mittel
"
,
"
Schwer
"
]
}
/>
</
div
>
<
SliderFilter
topic
=
{
"
Anbauphase
"
}
min
=
{
1
}
max
=
{
52
}
/>
<
SliderFilter
topic
=
{
"
Erntezeitraum
"
}
min
=
{
1
}
max
=
{
52
}
/>
<
SliderFilter
topic
=
{
"
Wachstumsdauer
"
}
min
=
{
1
}
max
=
{
52
}
/>
{
"
"
}
</>
);
}
/*function Filter() {
const options = ["Option 1", "Option 2", "Option 3"];
const [selectedOption, setSelectedOption] = useState("");
const handleOptionChange = (event) => {
setSelectedOption(event.target.value);
function
SliderFilter
({
topic
,
min
,
max
}:
PropsSliderFilter
)
{
const
[
range
,
setRange
]
=
useState
([
min
,
max
]);
const
handleRangeChange
=
(
newRange
:
any
)
=>
{
setRange
(
newRange
);
};
return
(
<>
<label>Wählen Sie eine Option:</label>
<select value={selectedOption} onChange={handleOptionChange}>
<option value="">-- Bitte wählen --</option>
{options.map((option, index) => (
<option key={index} value={option}>
{option}
</option>
))}
</select>
</>
<
div
>
<
label
>
{
topic
}
von KW
{
range
[
0
]
}
bis KW
{
range
[
1
]
}
</
label
>
<
Slider
min
=
{
min
}
max
=
{
max
}
range
value
=
{
range
}
onChange
=
{
handleRangeChange
}
/>
</
div
>
);
}*/
}
type
PropsSliderFilter
=
{
topic
:
string
;
min
:
number
;
max
:
number
;
};
export
default
FilterPage
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment