Skip to content

Commit

Permalink
feat(fab): exited (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgr34 authored and Matt Goo committed Feb 19, 2019
1 parent 6876e62 commit a646a33
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 249 deletions.
3 changes: 2 additions & 1 deletion packages/fab/README.md
Expand Up @@ -47,7 +47,8 @@ The Fab can be used with the `span`, `i`, `img` or `svg` elements. It can also b
Prop Name | Type | Description
--- | --- | ---
className | String | Classes to be applied to the root element.
mini | n/a | Enables the mini variant.
exited | Boolean | When true animates the FAB out of view. When this false, the FAB will return to view.
mini | Boolean | Enables the mini variant.
icon | Element | The icon.
textLabel | String | The label, which makes the FAB extended.

Expand Down
18 changes: 11 additions & 7 deletions packages/fab/index.tsx
Expand Up @@ -24,13 +24,15 @@ import * as React from 'react';
import * as classnames from 'classnames';
import * as Ripple from '@material/react-ripple';

export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement> {
mini?: boolean;
icon?: React.ReactElement<HTMLElement>;
textLabel?: string;
className?: string;
initRipple: React.Ref<HTMLButtonElement>;
unbounded: boolean;
export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement>,
React.ButtonHTMLAttributes<HTMLButtonElement> {
exited?: boolean;
mini?: boolean;
icon?: React.ReactElement<HTMLElement>;
textLabel?: string;
className?: string;
initRipple: React.Ref<HTMLButtonElement>;
unbounded: boolean;
}

const Icon: React.FunctionComponent<{icon?: React.ReactElement<HTMLElement>}> = ({icon}) => {
Expand All @@ -54,6 +56,7 @@ const TextLabel: React.FunctionComponent<{textLabel: string}> = ({

export const Fab: React.FunctionComponent<FabProps & React.HTMLProps<HTMLButtonElement>> = ({
/* eslint-disable react/prop-types */
exited = false,
mini = false,
icon,
textLabel = '',
Expand All @@ -67,6 +70,7 @@ export const Fab: React.FunctionComponent<FabProps & React.HTMLProps<HTMLButtonE
const classes = classnames('mdc-fab', className, {
'mdc-fab--mini': mini,
'mdc-fab--extended': extended,
'mdc-fab--exited': exited,
});

return (
Expand Down

0 comments on commit a646a33

Please sign in to comment.