Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SpeedDialAction] Add TooltipClasses prop #13848

Merged
merged 1 commit into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface SpeedDialActionProps
ButtonProps?: Partial<ButtonProps>;
delay?: number;
icon: React.ReactNode;
TooltipClasses?: TooltipProps['classes'];
tooltipPlacement?: TooltipProps['placement'];
tooltipTitle?: React.ReactNode;
tooltipOpen?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class SpeedDialAction extends React.Component {
onKeyDown,
open,
tooltipTitle,
TooltipClasses,
tooltipPlacement,
tooltipOpen,
...other
Expand Down Expand Up @@ -104,6 +105,7 @@ class SpeedDialAction extends React.Component {
onClose={this.handleTooltipClose}
onOpen={this.handleTooltipOpen}
open={open && this.state.tooltipOpen}
classes={TooltipClasses}
{...other}
>
<Fab
Expand Down Expand Up @@ -160,6 +162,10 @@ SpeedDialAction.propTypes = {
* @ignore
*/
open: PropTypes.bool,
/**
* Classes applied to the [`Tooltip`](/api/tooltip/) element.
*/
TooltipClasses: PropTypes.object,
/**
* Make the tooltip always visible when the SpeedDial is open.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ describe('<SpeedDialAction />', () => {
assert.strictEqual(wrapper.type(), Tooltip);
});

it('should be able to change the Tooltip classes', () => {
const wrapper = shallow(<SpeedDialAction {...defaultProps} />);
wrapper.setProps({ TooltipClasses: { root: 'bar' } });
assert.include(wrapper.props().classes.root, 'bar');
});

it('should render a Button', () => {
const wrapper = shallow(<SpeedDialAction {...defaultProps} />);
const buttonWrapper = wrapper.childAt(0);
Expand Down
1 change: 1 addition & 0 deletions pages/lab/api/speed-dial-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import SpeedDialAction from '@material-ui/lab/SpeedDialAction';
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Useful to extend the style applied to components. |
| <span class="prop-name">delay</span> | <span class="prop-type">number</span> | <span class="prop-default">0</span> | Adds a transition delay, to allow a series of SpeedDialActions to be animated. |
| <span class="prop-name required">icon *</span> | <span class="prop-type">node</span> |   | The Icon to display in the SpeedDial Floating Action Button. |
| <span class="prop-name">TooltipClasses</span> | <span class="prop-type">object</span> |   | Classes applied to the [`Tooltip`](/api/tooltip/) element. |
| <span class="prop-name">tooltipOpen</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Make the tooltip always visible when the SpeedDial is open. |
| <span class="prop-name">tooltipPlacement</span> | <span class="prop-type">enum:&nbsp;'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top'<br></span> | <span class="prop-default">'left'</span> | Placement of the tooltip. |
| <span class="prop-name required">tooltipTitle *</span> | <span class="prop-type">node</span> |   | Label to display in the tooltip. |
Expand Down