Merge pull request #513 from slumbering/500-docs-selector
display the right option from select + update logo
This commit is contained in:
commit
b55452a403
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -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" />
|
||||||
|
@ -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>
|
||||||
))}
|
))}
|
||||||
|
Reference in New Issue
Block a user