import { forwardRef, useImperativeHandle, useRef } from 'react'; import classnames from 'classnames'; import Box from './Box'; import styles from './ButtonSocial.css'; import AppleIcon from './ButtonSocial/AppleIcon'; import FacebookIcon from './ButtonSocial/FacebookIcon'; import GoogleIcon from './ButtonSocial/GoogleIcon'; import LineIcon from './ButtonSocial/LineIcon'; import VRButtonSocial from './ButtonSocial/VRButtonSocial'; import { useColorScheme } from './contexts/ColorSchemeProvider'; import { useDefaultLabelContext } from './contexts/DefaultLabelProvider'; import Flex from './Flex'; import focusStyles from './Focus.css'; import Icon from './Icon'; import Text from './Text'; import useFocusVisible from './useFocusVisible'; import useExperimentalTheme from './utils/useExperimentalTheme'; type Props = { /** * Available for testing purposes, if needed. Consider [better queries](https://testing-library.com/docs/queries/about/#priority) before using this prop. */ dataTestId?: string; /** * Callback invoked when the user clicks (press and release) on Button with the mouse or keyboard. */ onClick?: (arg1: { event: React.MouseEvent | React.KeyboardEvent; }) => void; /** * Text to render inside the ButtonSocial to convey the function and purpose of the ButtonSocial. */ type: 'login' | 'continue' | 'signup'; /** * Text to render inside the ButtonSocial to convey the function and purpose of the ButtonSocial. */ service: 'apple' | 'facebook' | 'google' | 'email' | 'line'; }; /** * [ButtonSocial](https://gestalt.pinterest.systems/buttonsocial) should be used only to enable users to sign-up or sign-in to Pinterest using other trusted services. * * ![ButtonSocial light mode](https://raw.githubusercontent.com/pinterest/gestalt/master/playwright/visual-test/ButtonSocial.spec.ts-snapshots/ButtonSocial-chromium-darwin.png) * ![ButtonSocial dark mode](https://raw.githubusercontent.com/pinterest/gestalt/master/playwright/visual-test/ButtonSocial-dark.spec.ts-snapshots/ButtonSocial-dark-chromium-darwin.png) */ const ButtonSocialWithForwardRef = forwardRef(function ButtonSocial( { dataTestId, onClick, type, service }: Props, ref, ) { const innerRef = useRef(null); // When using both forwardRef and innerRef, React.useimperativehandle() allows a parent component // that renders ); }); ButtonSocialWithForwardRef.displayName = 'ButtonSocial'; export default ButtonSocialWithForwardRef;