feat(lab): Add support for multiple versions in the lab
This commit is contained in:
parent
4db8ab099b
commit
d4833fb6a4
14 changed files with 280 additions and 48 deletions
16
packages/freesewing.lab/hooks/useVersion.js
Normal file
16
packages/freesewing.lab/hooks/useVersion.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { useRouter } from 'next/router'
|
||||
|
||||
export const defaultVersion = 'next'
|
||||
|
||||
const useVersion = () => {
|
||||
const { pathname } = useRouter()
|
||||
const chunks = pathname.split('/')
|
||||
const version = (chunks[1] === 'v')
|
||||
? chunks[2]
|
||||
: defaultVersion
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
export default useVersion
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue