Skip to content

Commit

Permalink
Merge pull request #5635 from storybooks/5600-fix-prop-warnings
Browse files Browse the repository at this point in the history
Fix some prop warnings
  • Loading branch information
shilman authored Feb 19, 2019
2 parents fb0f628 + 0326275 commit e05348a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion addons/actions/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function register() {
addons.register(ADDON_ID, api => {
addons.addPanel(PANEL_ID, {
title: 'Actions',
render: ({ active }) => <ActionLogger api={api} active={active} />,
render: ({ active, key }) => <ActionLogger key={key} api={api} active={active} />,
});
});
}
1 change: 1 addition & 0 deletions lib/addons/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import deprecate from 'util-deprecate';

export interface RenderOptions {
active: boolean;
key: string;
}
export interface RouteOptions {
storyId: string;
Expand Down
10 changes: 2 additions & 8 deletions lib/components/src/tooltip/WithTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,13 @@ const WithTooltip = ({
}) => {
const Container = svg ? TargetSvgContainer : TargetContainer;

if (tooltipShown !== undefined) {
Object.assign(props, { tooltipShown });
}
if (onVisibilityChange !== undefined) {
Object.assign(props, { onVisibilityChange });
}

return (
<TooltipTrigger
placement={placement}
trigger={trigger}
modifiers={modifiers}
{...props}
tooltipShown={tooltipShown}
onVisibilityChange={onVisibilityChange}
tooltip={({
getTooltipProps,
getArrowProps,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/src/components/sidebar/NotificationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ export default function NotificationList({ notifications }) {
}

NotificationList.propTypes = {
notifications: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.number.isRequired }).isRequired)
notifications: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired }).isRequired)
.isRequired,
};
2 changes: 1 addition & 1 deletion lib/ui/src/components/sidebar/NotificationList.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const notifications = Object.values(NotificationItemStories)
.filter(s => s.storyData)
.map(({ storyData: { notification } }, index) => ({
...notification,
id: index,
id: index.toString(),
}));
export const all = () => <NotificationList notifications={notifications} />;
all.storyData = { notifications };
Expand Down
12 changes: 7 additions & 5 deletions lib/ui/src/components/sidebar/SidebarSearch.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { actions as makeActions } from '@storybook/addon-actions';

import SidebarSearch, { PureSidebarSearch } from './SidebarSearch';

Expand All @@ -15,11 +15,13 @@ export default {
],
};

export const simple = () => <SidebarSearch />;
const actions = makeActions('onChange');
const pureActions = { ...actions, ...makeActions('onSetFocussed') };

const onSetFocussed = action('onSetFocussed');
export const focussed = () => <PureSidebarSearch focussed onSetFocussed={onSetFocussed} />;
export const simple = () => <SidebarSearch {...actions} />;

export const focussed = () => <PureSidebarSearch focussed {...pureActions} />;

export const filledIn = () => (
<PureSidebarSearch focussed onSetFocussed={onSetFocussed} defaultValue="Searchstring" />
<PureSidebarSearch focussed defaultValue="Searchstring" {...pureActions} />
);

0 comments on commit e05348a

Please sign in to comment.