Skip to content

Commit

Permalink
feat(utahid): allow size to be passed through to the button
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Jan 22, 2025
1 parent 3c7d72c commit 9d6ad92
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions packages/utah-design-system/src/components/UtahIdLogin.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { signInWithPopup } from 'firebase/auth';
import { useCallback } from 'react';
import { useFirebaseAuth } from '../contexts';
import { Button } from './Button';
import { Button, type ButtonProps } from './Button';

export const UtahIdLogin = () => {
export const UtahIdLogin = ({
size = 'medium',
}: {
size: ButtonProps['size'];
}) => {
const { auth, provider } = useFirebaseAuth() || {};

const handlePress = useCallback(() => {
Expand All @@ -19,11 +23,24 @@ export const UtahIdLogin = () => {
signInWithPopup(auth, provider);
}, [auth]);

let height = 'h-6';
if (size === 'extraSmall') {
height = 'h-4';
} else if (size === 'small') {
height = 'h-5';
} else if (size === 'medium') {
height = 'h-6';
} else if (size === 'large') {
height = 'h-7';
} else if (size === 'extraLarge') {
height = 'h-9';
}

return (
<Button onPress={handlePress}>
<Button onPress={handlePress} size={size}>
<span className="sr-only">Log in with Utahid</span>
<svg
className="h-auto w-20 fill-current"
className={`${height} w-auto fill-current`}
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 638.43 197"
Expand Down

0 comments on commit 9d6ad92

Please sign in to comment.