1
0
mirror of synced 2025-12-20 10:28:40 -05:00
Files
docs/components/hooks/useVersion.ts
Grace Park f19223503a Update Search Version Button to Dropdown (#23465)
* adding to view

* updating the portal location

* add new line

* updating font styling to class

* Update components/Search.tsx

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>

* Update components/Search.module.scss

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>

* update ItemInput

* using router.replace and import updates

* Update components/Search.tsx

Co-authored-by: Peter Bengtsson <peterbe@github.com>

* run prettier

* Update components/Search.tsx

Co-authored-by: Peter Bengtsson <peterbe@github.com>

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
Co-authored-by: Peter Bengtsson <peterbe@github.com>
2021-12-09 17:56:24 +00:00

18 lines
516 B
TypeScript

import { useRouter } from 'next/router'
type VersionInfo = {
currentVersion: string
isEnterprise: boolean
isEnterpriseServer: boolean
}
export const DEFAULT_VERSION = 'free-pro-team@latest'
export const useVersion = (): VersionInfo => {
const router = useRouter()
const currentVersion = (router.query.versionId as string) || DEFAULT_VERSION
return {
currentVersion,
isEnterprise: currentVersion.includes('enterprise'),
isEnterpriseServer: currentVersion.includes('enterprise-server'),
}
}