-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REFACTOR no scroller around Tabs content, instead force scroll on child
This I hacky, I know but we need to scroll over content, without the Actionbar component, that should stick. I'd like to refactor the Tabs component so it can render ActionBar independently, but that a bigger overhaul, then I feel comfortable with at the moment. Most of our addons will show a custom scrollbar now, but it's a manual process, the addon rendering is taking control over scrolling. Instead I'd like tabs to be in control of scrolling, but that's currently not feasable with how ActionBar works.
- Loading branch information
Showing
11 changed files
with
109 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
import React, {Fragment} from 'react'; | ||
import Inspector from 'react-inspector'; | ||
import React, { Fragment } from 'react'; | ||
import { styled, withTheme } from '@storybook/theming'; | ||
|
||
import { withTheme } from '@storybook/theming'; | ||
import Inspector from 'react-inspector'; | ||
import { ActionBar, ScrollArea } from '@storybook/components'; | ||
|
||
import { Actions, Action, InspectorContainer, Counter, StyledActionBar } from './style'; | ||
import { Action, InspectorContainer, Counter } from './style'; | ||
import { ActionDisplay } from '../../models'; | ||
|
||
export const Wrapper = styled(({ children, className }) => ( | ||
<ScrollArea horizontal vertical className={className}> | ||
{children} | ||
</ScrollArea> | ||
))({ | ||
margin: 0, | ||
padding: '10px 5px 20px', | ||
}); | ||
|
||
const ThemedInspector = withTheme(({ theme, ...props }) => <Inspector theme={theme.addonActionsTheme || 'chromeLight'} {...props} />); | ||
|
||
interface ActionLoggerProps { | ||
actions: ActionDisplay[]; | ||
onClear: () => void; | ||
theme: any; | ||
} | ||
|
||
export const ActionLogger = withTheme(({ actions, onClear, theme }: ActionLoggerProps) => ( | ||
export const ActionLogger = ({ actions, onClear }: ActionLoggerProps) => ( | ||
<Fragment> | ||
<Actions> | ||
<Wrapper title="actionslogger"> | ||
{actions.map((action: ActionDisplay) => ( | ||
<Action key={action.id}> | ||
{action.count > 1 && <Counter>{action.count}</Counter>} | ||
<InspectorContainer> | ||
<Inspector | ||
theme={theme.addonActionsTheme || 'chromeLight'} | ||
sortObjectKeys | ||
showNonenumerable={false} | ||
name={action.data.name} | ||
data={action.data.args || action.data} | ||
/> | ||
<ThemedInspector sortObjectKeys showNonenumerable={false} name={action.data.name} data={action.data.args || action.data} /> | ||
</InspectorContainer> | ||
</Action> | ||
))} | ||
</Actions> | ||
</Wrapper> | ||
|
||
<StyledActionBar actionItems={[{ title: 'Clear', onClick: onClear }]} /> | ||
<ActionBar actionItems={[{ title: 'Clear', onClick: onClear }]} /> | ||
</Fragment> | ||
)); | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters