fix: 🐛 display the right option from select + update logo

Signed-off-by: slumbering <slumbering.pierrot@gmail.com>
This commit is contained in:
slumbering 2021-05-27 17:08:01 +02:00
parent b47512ba6e
commit a959b420a2
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>
))} ))}