Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix: add className props
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecilia Woodward committed Aug 20, 2021
1 parent 4f7b856 commit 5b8b1e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions stories/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Spinner } from './Spinner';
export interface ButtonProps {
[key: string]: any;
children: ReactNode;
className?: string;
disabled?: boolean;
inverse?: boolean;
loading?: boolean;
Expand All @@ -20,6 +21,7 @@ export interface ButtonProps {
*/
export const Button: FunctionComponent<ButtonProps> = ({
children,
className,
disabled = false,
inverse = false,
loading = false,
Expand All @@ -39,6 +41,7 @@ export const Button: FunctionComponent<ButtonProps> = ({
isDisabled && styles.disabled,
loading && styles.loading,
inverse && styles.inverse,
className,
)}
onClick={() => {
if (!isDisabled) onClick()
Expand Down
4 changes: 4 additions & 0 deletions stories/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface CheckboxProps {
*/
checked?: boolean;

className?: string;

/**
* Disables the component.
*/
Expand All @@ -21,6 +23,7 @@ export interface CheckboxProps {

export const Checkbox: FunctionComponent<CheckboxProps> = ({
checked = false,
className,
disabled = false,
onChange,
}: CheckboxProps) => {
Expand All @@ -41,6 +44,7 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
styles.checkbox,
internallyChecked && styles.checked,
disabled && styles.disabled,
className,
)}
onClick={updateValue}
>
Expand Down
8 changes: 7 additions & 1 deletion stories/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import React, { FunctionComponent } from 'react';
import { FaFacebookF, FaTwitter, FaShare, FaHeart } from 'react-icons/fa';
import { GoPlus } from 'react-icons/go';
Expand All @@ -14,18 +15,23 @@ export const ICON_MAP = {
};

export interface IconProps {
className?: string;
icon: keyof typeof ICON_MAP;
}

export const Icon: FunctionComponent<IconProps> = ({
className,
icon,
...props
}: IconProps) => {
const MappedIcon = ICON_MAP[icon];

return (
<MappedIcon
className={styles.icon}
className={classNames(
styles.icon,
className,
)}
{...props}
/>
)
Expand Down

0 comments on commit 5b8b1e4

Please sign in to comment.