Merge pull request #20219 from overleaf/rd-dropdown-alignment

[web] Language picker dropdown should expand to the top

GitOrigin-RevId: 591a6fc013d2a9e841acd09d6881727aed38471b
This commit is contained in:
Rebeka Dekany 2024-09-02 14:12:55 +02:00 committed by Copybot
parent 1f6418f48f
commit 54fb884aaf
3 changed files with 9 additions and 2 deletions

View file

@ -18,7 +18,7 @@ function LanguagePicker() {
const currentUrlWithQueryParams = window.location.pathname
return (
<Dropdown>
<Dropdown drop="up">
<DropdownToggle
id="language-picker-toggle"
aria-label={t('select_a_language')}
@ -37,7 +37,12 @@ function LanguagePicker() {
<DropdownMenu className="sm" aria-labelledby="language-picker-toggle">
{subdomainLang &&
Object.entries(subdomainLang).map(([subdomain, subdomainDetails]) => {
if (!subdomainDetails || !subdomainDetails.lngCode) return null
if (
!subdomainDetails ||
!subdomainDetails.lngCode ||
subdomainDetails.hide
)
return null
const isActive = subdomainDetails.lngCode === currentLangCode
return (
<li role="none" key={subdomain}>

View file

@ -17,6 +17,7 @@ export type DropdownProps = {
onToggle?: (show: boolean) => void
show?: boolean
autoClose?: boolean | 'inside' | 'outside'
drop?: 'up' | 'up-centered' | 'start' | 'end' | 'down' | 'down-centered'
}
export type DropdownItemProps = PropsWithChildren<{

View file

@ -1,4 +1,5 @@
export interface SubdomainDetails {
hide?: boolean
lngCode: string
url: string
}