fix: consistently style login page

pull/2211/head
TheCatLady 3 years ago
parent dc23d7698f
commit a63e2b2c83
No known key found for this signature in database
GPG Key ID: 9DAC5971F01EE4AE

@ -19,13 +19,19 @@ export interface AccordionChildProps {
type AccordionContentProps = { type AccordionContentProps = {
isOpen: boolean; isOpen: boolean;
children: React.ReactNode; children: React.ReactNode;
className?: string;
}; };
export const AccordionContent = ({ export const AccordionContent = ({
isOpen, isOpen,
children, children,
className,
}: AccordionContentProps) => { }: AccordionContentProps) => {
return <AnimateHeight height={isOpen ? 'auto' : 0}>{children}</AnimateHeight>; return (
<AnimateHeight height={isOpen ? 'auto' : 0} className={className}>
{children}
</AnimateHeight>
);
}; };
const Accordion = ({ const Accordion = ({

@ -145,29 +145,39 @@ const Login = () => {
{({ openIndexes, handleClick, AccordionContent }) => ( {({ openIndexes, handleClick, AccordionContent }) => (
<> <>
{signinMethods.map((signinMethod, index) => ( {signinMethods.map((signinMethod, index) => (
<> <div
key={`accordion-${index}`}
className="ring-1 ring-gray-700 sm:first:rounded-t-lg sm:last:rounded-b-lg"
>
<button <button
className={`w-full cursor-default bg-gray-800 bg-opacity-70 py-2 text-center text-base font-bold focus:outline-none sm:first:rounded-t-lg ${ className={`w-full cursor-default bg-gray-800 bg-opacity-70 py-2 text-center text-base font-bold focus:outline-none ${
index === 0 ? 'sm:rounded-t-lg' : ''
} ${
openIndexes.includes(index) openIndexes.includes(index)
? 'text-indigo-500' ? 'text-indigo-500'
: `text-gray-400 ${ : `text-gray-400 ${
index === signinMethods.length - 1 index === signinMethods.length - 1
? 'sm:rounded-b-lg' ? 'sm:rounded-b-lg'
: '' : ''
} ${
signinMethods.length > 1
? 'transition-colors duration-200 hover:cursor-pointer hover:bg-gray-700'
: ''
}` }`
} ${
signinMethods.length > 1
? 'transition-colors duration-200 hover:cursor-pointer hover:bg-gray-700'
: ''
}`} }`}
onClick={() => handleClick(index)} onClick={() => handleClick(index)}
> >
{signinMethod.buttonText} {signinMethod.buttonText}
</button> </button>
<AccordionContent isOpen={openIndexes.includes(index)}> <AccordionContent
isOpen={openIndexes.includes(index)}
className={
index < signinMethods.length - 1 ? 'mb-px' : ''
}
>
<div className="px-10 py-8">{signinMethod.content}</div> <div className="px-10 py-8">{signinMethod.content}</div>
</AccordionContent> </AccordionContent>
</> </div>
))} ))}
</> </>
)} )}

Loading…
Cancel
Save