mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-08-23 09:07:40 -05:00
feat(component): style button component to support icon-only buttons
This commit is contained in:
@@ -6,6 +6,7 @@ import styles from './Button.module.css';
|
||||
* A reusable component for buttons.
|
||||
*
|
||||
* @param {boolean} isPrimary - Whether the button is primary or not. Defaults to false.
|
||||
* @param {boolean} isIcon - Whether the button only contains an icon. Defaults to false.
|
||||
* @param className - An optional classname.
|
||||
* @param {string} style - Custom styles to apply to the title.
|
||||
*
|
||||
@@ -15,9 +16,9 @@ import styles from './Button.module.css';
|
||||
*/
|
||||
|
||||
export default function Button(ctx) {
|
||||
const { children, className, isPrimary, onClick } = ctx;
|
||||
const { children, className, isPrimary, isIcon, onClick } = ctx;
|
||||
return (
|
||||
<button className={classNames(styles.button, { [styles.primary]: isPrimary }, className)} onClick={onClick}>
|
||||
<button className={classNames(styles.button, { [styles.primary]: isPrimary, [styles.icon]: isIcon }, className)} onClick={onClick}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -10,6 +10,13 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button.icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background: var(--bg-shade-3-5);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user