Merge pull request #513 from slumbering/500-docs-selector

display the right option from select + update logo
This commit is contained in:
Andrea Luzzardi 2021-05-27 14:28:11 -07:00 committed by GitHub
commit b55452a403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import logo from '../assets/dagger-logo.jpg' import logo from '../assets/dagger-logo.png'
export default function Logo(props) { export default function Logo(props) {
return <img src={logo} alt="Logo" /> return <img src={logo} alt="Logo" />

View File

@ -5,7 +5,7 @@ const Select = () => {
const isBrowser = typeof window !== "undefined" const isBrowser = typeof window !== "undefined"
const [tagsList, setTagsList] = useState([]) const [tagsList, setTagsList] = useState([])
const currentLocation = isBrowser ? window.location.pathname.split('/') : [] const currentLocation = isBrowser ? window.location.pathname.split('/') : []
currentLocation.pop() //remove last trailing slash currentLocation.shift() //remove last trailing slash
useEffect(() => { useEffect(() => {
async function getTags() { async function getTags() {
@ -19,7 +19,7 @@ const Select = () => {
}, []) }, [])
return ( return (
<SelectStyled value={currentLocation[currentLocation.length - 1]} onChange={(e) => isBrowser ? window.location.pathname = `/${e.currentTarget.value}` : null}> <SelectStyled value={currentLocation[0]} onChange={(e) => isBrowser ? window.location.pathname = `/${e.currentTarget.value}` : null}>
{tagsList.map(t => ( {tagsList.map(t => (
<option>{t.tag}</option> <option>{t.tag}</option>
))} ))}