some pattern picker fixes
This commit is contained in:
parent
8fc493858e
commit
72d756b621
5 changed files with 7 additions and 6 deletions
|
@ -10,7 +10,6 @@ export const BeforeNav = ({ app }) => (
|
||||||
<LocalePicker app={app} />
|
<LocalePicker app={app} />
|
||||||
</div>
|
</div>
|
||||||
<div className="md:hidden flex flex-row flex-wrap sm:flex-nowrap gap-2 mb-2">
|
<div className="md:hidden flex flex-row flex-wrap sm:flex-nowrap gap-2 mb-2">
|
||||||
<PatternPicker app={app} />
|
|
||||||
<VersionPicker app={app} />
|
<VersionPicker app={app} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -33,7 +33,7 @@ const PatternPicker = ({ app }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (<PickerLink {...patternProps} key={pattern}>
|
return (<PickerLink {...patternProps} key={pattern}>
|
||||||
<span className="sr-only">{sectionTitle}</span> {app.navigation[section][pattern].__title}
|
<span className="sr-only" key={pattern}>{sectionTitle}</span> {app.navigation[section][pattern].__title}
|
||||||
</PickerLink>)
|
</PickerLink>)
|
||||||
})}
|
})}
|
||||||
</React.Fragment>)}
|
</React.Fragment>)}
|
||||||
|
|
|
@ -10,7 +10,8 @@ const LocalePicker = ({ app, iconOnly=false }) => {
|
||||||
const pickerProps = {
|
const pickerProps = {
|
||||||
iconOnly,
|
iconOnly,
|
||||||
Icon: LocaleIcon,
|
Icon: LocaleIcon,
|
||||||
title: t(router.locale)
|
title: t(router.locale),
|
||||||
|
end: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { Menu } from '@headlessui/react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
/** an accessible dropdown menu for use by picker components */
|
/** an accessible dropdown menu for use by picker components */
|
||||||
export const Picker = ({Icon, className, title, ariaLabel, iconOnly=false, children}) => {
|
export const Picker = ({Icon, className, title, ariaLabel, iconOnly=false, children, ...props}) => {
|
||||||
|
|
||||||
return (<Menu as="div" className={`dropdown dropdown-end w-auto`}>
|
return (<Menu as="div" className={`dropdown w-auto ${props.end ? 'dropdown-end' : ''}`}>
|
||||||
<Menu.Button className={iconOnly
|
<Menu.Button className={iconOnly
|
||||||
? `btn btn-sm`
|
? `btn btn-sm`
|
||||||
: `m-0 btn btn-neutral flex flex-row gap-2
|
: `m-0 btn btn-neutral flex flex-row gap-2
|
||||||
|
|
|
@ -16,7 +16,8 @@ const ThemePicker = ({ app, className, iconOnly=false }) => {
|
||||||
iconOnly,
|
iconOnly,
|
||||||
Icon: ThemeIcon,
|
Icon: ThemeIcon,
|
||||||
title: t(`${app.theme}Theme`),
|
title: t(`${app.theme}Theme`),
|
||||||
ariaLabel: t('themesPicker')
|
ariaLabel: t('themesPicker'),
|
||||||
|
end: true
|
||||||
}
|
}
|
||||||
return (<Picker {...pickerProps}>
|
return (<Picker {...pickerProps}>
|
||||||
{Object.keys(themes).map(theme => (
|
{Object.keys(themes).map(theme => (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue