1
0
Fork 0

some pattern picker fixes

This commit is contained in:
Enoch Riese 2022-07-15 17:40:18 -04:00
parent 8fc493858e
commit 72d756b621
5 changed files with 7 additions and 6 deletions

View file

@ -10,7 +10,6 @@ export const BeforeNav = ({ app }) => (
<LocalePicker app={app} />
</div>
<div className="md:hidden flex flex-row flex-wrap sm:flex-nowrap gap-2 mb-2">
<PatternPicker app={app} />
<VersionPicker app={app} />
</div>
</>

View file

@ -33,7 +33,7 @@ const PatternPicker = ({ app }) => {
}
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>)
})}
</React.Fragment>)}

View file

@ -10,7 +10,8 @@ const LocalePicker = ({ app, iconOnly=false }) => {
const pickerProps = {
iconOnly,
Icon: LocaleIcon,
title: t(router.locale)
title: t(router.locale),
end: true
}
return (

View file

@ -3,9 +3,9 @@ import { Menu } from '@headlessui/react'
import Link from 'next/link'
/** 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
? `btn btn-sm`
: `m-0 btn btn-neutral flex flex-row gap-2

View file

@ -16,7 +16,8 @@ const ThemePicker = ({ app, className, iconOnly=false }) => {
iconOnly,
Icon: ThemeIcon,
title: t(`${app.theme}Theme`),
ariaLabel: t('themesPicker')
ariaLabel: t('themesPicker'),
end: true
}
return (<Picker {...pickerProps}>
{Object.keys(themes).map(theme => (