-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from BCIT-SSD-2020-21/13Search
13 search
- Loading branch information
Showing
13 changed files
with
320 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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
25 changes: 25 additions & 0 deletions
25
client/src/components/sidebar/collapsiblePanel/CollapsiblePanel.css
This file contains 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,25 @@ | ||
.coll-panel-btn { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
|
||
} | ||
|
||
.coll-panel-btn:focus { | ||
outline: 0; | ||
box-shadow: none; | ||
} | ||
|
||
.leftIcon > i { | ||
margin-right: 5px; | ||
} | ||
|
||
.leftIcon { | ||
width: 70%; | ||
} | ||
|
||
|
||
|
||
|
51 changes: 51 additions & 0 deletions
51
client/src/components/sidebar/collapsiblePanel/CollapsiblePanel.js
This file contains 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,51 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import './CollapsiblePanel.css' | ||
|
||
function CollapsiblePanel({ children, ...props }) { | ||
const { title, collapse, leftIcon } = props; | ||
const [isCollapse, setIsCollapse] = useState(collapse); | ||
const [icon, setIcon] = useState("fa fa-chevron-down"); | ||
const toggle = () => { | ||
setIsCollapse(!isCollapse); | ||
setIcon(state => { | ||
return state === "fa fa-chevron-down" | ||
? "fa fa-chevron-right" | ||
: "fa fa-chevron-down"; | ||
}); | ||
}; | ||
|
||
const animate = collapse => { | ||
setIsCollapse(collapse); | ||
setIcon(state => { | ||
return state === "fa fa-chevron-down" | ||
? "fa fa-chevron-right" | ||
: "fa fa-chevron-down"; | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
animate(!collapse); | ||
}, [collapse]); | ||
|
||
return ( | ||
<div className="coll-panel"> | ||
<div | ||
className="coll-panel-btn" | ||
onClick={() => toggle()} | ||
style={{color: 'white'}} | ||
> | ||
<div className="leftIcon"><i className={leftIcon} /><a href="#"> {title} </a> </div> | ||
<div className="rightIcon"><i className={icon} /></div> | ||
</div> | ||
{ isCollapse && children} | ||
</div> | ||
); | ||
} | ||
|
||
CollapsiblePanel.defaultProps = { | ||
children: "Add node as a child", | ||
title: "Collapsible Panel", | ||
collapse: true | ||
}; | ||
|
||
export default CollapsiblePanel; |
This file contains 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,52 @@ | ||
.search-root { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 0.5rem; | ||
background-color:transparent; | ||
margin: 0 10px; | ||
padding: 0px; | ||
border: 1px solid #FFFFFF66; | ||
width: 100%; | ||
} | ||
|
||
.search-form { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
background-color:transparent; | ||
margin: 0; | ||
padding: 0 10px; | ||
border: 1px solid #FFFFFF66; | ||
width: 100%; | ||
|
||
} | ||
|
||
.search_string { | ||
font-size: 1rem; | ||
width: 100%; | ||
margin: 10px 0; | ||
padding: 0 5px; | ||
} | ||
|
||
#cropperform-species { | ||
font-size: 0.7rem; | ||
} | ||
|
||
.search_submitButton { | ||
width: 100%; | ||
height: 1.5rem; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 10px; | ||
padding: 0 20px; | ||
border-radius: 5px; | ||
text-align: center; | ||
cursor: pointer; | ||
color: #00000099; | ||
font-size: 0.7rem; | ||
} | ||
|
This file contains 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,45 @@ | ||
import React, {useState} from 'react' | ||
import './Search.css' | ||
import { BsForward, BsCameraVideo } from 'react-icons/bs'; | ||
import { useHistory } from 'react-router-dom' | ||
|
||
export default function Search() { | ||
const history = useHistory(); | ||
|
||
const [search, setSearch] = useState('') | ||
const [species, setSpecies] = useState('') | ||
|
||
const handleSubmit = e => { | ||
e.preventDefault() | ||
history.push(`/posts/?search=${search}`) | ||
|
||
} | ||
|
||
return ( | ||
<div className="search-root" > | ||
<div className="search-form"> | ||
|
||
<input type="text" className=" search_string" name="search" placeholder="pet name, etc." value={search} onChange={(e)=>setSearch(e.target.value)}></input> | ||
|
||
<select id="cropperform-species" className="form-control" name="species" aria-required="true" onChange={(e)=>setSpecies(e.target.value)}> | ||
<option value="">Choose Species...</option> | ||
<option value="Dog">Dog</option> | ||
<option value="Cat">Cat</option> | ||
<option value="Bird">Bird</option> | ||
<option value="Horse">Horse</option> | ||
<option value="Rabbit">Rabbit</option> | ||
<option value="Reptile">Reptile</option> | ||
<option value="Ferret">Ferret</option> | ||
<option value="Other">Other</option> | ||
</select> | ||
|
||
<button className="search_submitButton" onClick={handleSubmit}> | ||
<BsForward style={{marginRight: '0.5rem'}} size={25} /> | ||
<span>Update</span> | ||
</button> | ||
</div> | ||
</div> | ||
|
||
) | ||
} | ||
|
This file contains 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 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
Oops, something went wrong.