diff --git a/sites/lab/components/pattern-picker.js b/sites/lab/components/pattern-picker.js
index 0a1f68b0b08..72f979a85f3 100644
--- a/sites/lab/components/pattern-picker.js
+++ b/sites/lab/components/pattern-picker.js
@@ -1,47 +1,44 @@
import React from 'react'
-import DesignIcon from 'shared/components/icons/design.js'
-import Link from 'next/link'
+import DesignIcon from 'shared/components/icons/design'
import { useTranslation } from 'next-i18next'
+import {Picker, PickerLink} from 'shared/components/picker'
const PatternPicker = ({ app }) => {
const { t } = useTranslation(['common'])
- return (
-
-
-
- {t('designs')}
-
-
- {Object.keys(app.navigation).map(section => (
-
- -
- {t(app.navigation[section].__title)}
-
- {Object.keys(app.navigation[section]).filter((p)=>!p.startsWith('__')).map(pattern => {
- return (
- -
-
-
-
-
- )})}
-
- ))}
-
-
- )
+ const pickerProps = {
+ Icon: DesignIcon,
+ title: t('designs'),
+ className: 'overflow-y-scroll navdrop'
+ }
+
+ return (
+ {Object.keys(app.navigation).map(section => {
+ const sectionProps = {
+ selectedItem: t(app.navigation[section].__title),
+ isStatic: true
+ }
+ const sectionTitle = t(app.navigation[section].__title);
+ {return (
+
+ {sectionTitle}
+
+ {Object.keys(app.navigation[section]).filter((p)=>!p.startsWith('__')).map(pattern => {
+ const patternProps = {
+ href: app.navigation[section][pattern].__slug,
+ key: pattern
+ }
+
+ return (
+ {sectionTitle} {app.navigation[section][pattern].__title}
+ )
+ })}
+ )}
+ })}
+ )
}
export default PatternPicker
diff --git a/sites/lab/components/version-picker.js b/sites/lab/components/version-picker.js
index d358d596fdc..3e89b4d6bb3 100644
--- a/sites/lab/components/version-picker.js
+++ b/sites/lab/components/version-picker.js
@@ -1,9 +1,9 @@
import React from 'react'
import VersionsIcon from 'shared/components/icons/versions.js'
-import Link from 'next/link'
import { useTranslation } from 'next-i18next'
import versions from 'site/versions.json'
import useVersion from 'site/hooks/useVersion.js'
+import {Picker, PickerLink} from 'shared/components/picker'
export const defaultVersion = 'next'
@@ -23,31 +23,16 @@ const PatternPicker = ({ app }) => {
const { t } = useTranslation(['common'])
const version = useVersion()
- return (
-
-
-
- {formatVersionTitle(version)}
-
-
- {[defaultVersion, ...versions].map(v => (
- -
-
-
-
-
- ))}
-
-
- )
+ const pickerProps = {
+ title: formatVersionTitle(version),
+ Icon: VersionsIcon
+ }
+
+ return (
+ {[defaultVersion, ...versions].map(v => (
+ {formatVersionTitle(v)}
+ ))}
+ )
}
export default PatternPicker
diff --git a/sites/shared/components/locale-picker.js b/sites/shared/components/locale-picker.js
index b7c78999dc1..56e8e31e1bb 100644
--- a/sites/shared/components/locale-picker.js
+++ b/sites/shared/components/locale-picker.js
@@ -2,9 +2,7 @@ import themes from 'shared/themes/index.js'
import LocaleIcon from 'shared/components/icons/i18n.js'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
-import Link from 'next/link'
-import Picker, {PickerLink} from './picker';
-import { Menu } from '@headlessui/react'
+import {Picker, PickerLink} from './picker';
const LocalePicker = ({ app, iconOnly=false }) => {
const { t } = useTranslation(['locales'])
@@ -13,7 +11,7 @@ const LocalePicker = ({ app, iconOnly=false }) => {
const pickerProps = {
iconOnly,
Icon: LocaleIcon,
- selectedItem: t(router.locale)
+ title: t(router.locale)
}
return (
@@ -28,34 +26,6 @@ const LocalePicker = ({ app, iconOnly=false }) => {
))}
)
-
- // return (
- //
- //
- //
- // {!iconOnly && {t(router.locale)}}
- //
- //
- //
- // )
}
export default LocalePicker
diff --git a/sites/shared/components/picker.js b/sites/shared/components/picker.js
index 44949b422de..4fe7b8113f0 100644
--- a/sites/shared/components/picker.js
+++ b/sites/shared/components/picker.js
@@ -2,9 +2,9 @@ import {useRef, forwardRef} from 'react'
import { Menu } from '@headlessui/react'
import Link from 'next/link'
-const Picker = ({Icon, className, selectedItem, iconOnly=false, children}) => {
+export const Picker = ({Icon, className, title, iconOnly=false, children, isStatic=false}) => {
- return (