This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-7529](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-7529). --- ### Description - Migrated all button components to `twenty-ui` \ \ `Button`\ `ButtonGroup`\ `ColorPickerButton`\ `FloatingButton`\ `FloatingButtonGroup`\ `FloatingIconButton`\ `FloatingIconButtonGroup`\ `IconButton`\ `IconButtonGroup`\ `LightButton`\ `LightIconButton`\ `LightIconButtonGroup`\ `MainButton`\ \ Fixes twentyhq/private-issues#89 Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: Charles Bochet <charles@twenty.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { useTheme } from '@emotion/react';
|
|
import styled from '@emotion/styled';
|
|
import { Button, IconCopy } from 'twenty-ui';
|
|
|
|
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
|
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
|
import { TextInput } from '@/ui/input/components/TextInput';
|
|
|
|
const StyledContainer = styled.div`
|
|
display: flex;
|
|
flex-direction: row;
|
|
`;
|
|
|
|
const StyledLinkContainer = styled.div`
|
|
flex: 1;
|
|
margin-right: ${({ theme }) => theme.spacing(2)};
|
|
`;
|
|
|
|
type ApiKeyInputProps = { apiKey: string };
|
|
|
|
export const ApiKeyInput = ({ apiKey }: ApiKeyInputProps) => {
|
|
const theme = useTheme();
|
|
|
|
const { enqueueSnackBar } = useSnackBar();
|
|
return (
|
|
<StyledContainer>
|
|
<StyledLinkContainer>
|
|
<TextInput value={apiKey} fullWidth />
|
|
</StyledLinkContainer>
|
|
<Button
|
|
Icon={IconCopy}
|
|
title="Copy"
|
|
onClick={() => {
|
|
enqueueSnackBar('API Key copied to clipboard', {
|
|
variant: SnackBarVariant.Success,
|
|
icon: <IconCopy size={theme.icon.size.md} />,
|
|
duration: 2000,
|
|
});
|
|
navigator.clipboard.writeText(apiKey);
|
|
}}
|
|
/>
|
|
</StyledContainer>
|
|
);
|
|
};
|