Skip to content

Commit 860eab8

Browse files
committed
Fix anon dropdown button width
1 parent 0850158 commit 860eab8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

components/nav/common.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ export function MeDropdown ({ me, dropNavKey }) {
223223
)
224224
}
225225

226+
// this is the width of the 'switch account' button if no width is given
227+
const SWITCH_ACCOUNT_BUTTON_WIDTH = '162px'
228+
226229
export function SignUpButton ({ className = 'py-0', width }) {
227230
const router = useRouter()
228231
const handleLogin = useCallback(async pathname => await router.push({
@@ -233,7 +236,8 @@ export function SignUpButton ({ className = 'py-0', width }) {
233236
return (
234237
<Button
235238
className={classNames('align-items-center ps-2 pe-3', className)}
236-
style={{ borderWidth: '2px', width: width || '150px' }}
239+
// 161px is the width of the 'switch account' button
240+
style={{ borderWidth: '2px', width: width || SWITCH_ACCOUNT_BUTTON_WIDTH }}
237241
id='signup'
238242
onClick={() => handleLogin('/signup')}
239243
>
@@ -257,7 +261,7 @@ export default function LoginButton () {
257261
<Button
258262
className='align-items-center px-3 py-1'
259263
id='login'
260-
style={{ borderWidth: '2px', width: '150px' }}
264+
style={{ borderWidth: '2px', width: SWITCH_ACCOUNT_BUTTON_WIDTH }}
261265
variant='outline-grey-darkmode'
262266
onClick={() => handleLogin('/login')}
263267
>
@@ -344,7 +348,7 @@ function SwitchAccountButton ({ handleClose }) {
344348
<Button
345349
className='align-items-center px-3 py-1'
346350
variant='outline-grey-darkmode'
347-
style={{ borderWidth: '2px', width: '150px' }}
351+
style={{ borderWidth: '2px', width: SWITCH_ACCOUNT_BUTTON_WIDTH }}
348352
onClick={() => {
349353
// login buttons rendered in offcanvas aren't wrapped inside <Dropdown>
350354
// so we manually close the offcanvas in that case by passing down handleClose here

0 commit comments

Comments
 (0)