mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-23 01:48:13 +01:00
Sticker Creator
This commit is contained in:
committed by
Scott Nonnenberg
parent
2df1ba6e61
commit
11d47a8eb9
39
sticker-creator/elements/Button.tsx
Normal file
39
sticker-creator/elements/Button.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import * as React from 'react';
|
||||
import * as classnames from 'classnames';
|
||||
import * as styles from './Button.scss';
|
||||
|
||||
export type Props = React.HTMLProps<HTMLButtonElement> & {
|
||||
className?: string;
|
||||
pill?: boolean;
|
||||
primary?: boolean;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const getClassName = ({ primary, pill }: Props) => {
|
||||
if (pill && primary) {
|
||||
return styles.pillPrimary;
|
||||
}
|
||||
|
||||
if (pill) {
|
||||
return styles.pill;
|
||||
}
|
||||
|
||||
if (primary) {
|
||||
return styles.primary;
|
||||
}
|
||||
|
||||
return styles.base;
|
||||
};
|
||||
|
||||
export const Button = (props: Props) => {
|
||||
const { className, pill, primary, children, ...otherProps } = props;
|
||||
|
||||
return (
|
||||
<button
|
||||
className={classnames(getClassName(props), className)}
|
||||
{...otherProps}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user