Skip to content

Commit

Permalink
code review fixes in Example app base
Browse files Browse the repository at this point in the history
  • Loading branch information
nishikaza committed Jul 30, 2019
1 parent 8acb904 commit 0b06f7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export const getStyles: IStyleFunction<IExampleCardStyleProps, IExampleCardStyle
code: [
{
backgroundColor: NeutralColors.gray20,
// overflow: 'hidden',
selectors: {
pre: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ export class ExampleCardBase extends React.Component<IExampleCardProps, IExample
}
if (this.props.onToggleEditor) {
if (this.props.isCodeVisible) {
this.props.onToggleEditor('', this.Editor);
this.props.onToggleEditor('');
} else {
this.props.onToggleEditor(this.props.title, this.Editor);
this.props.onToggleEditor(this.props.title);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export const ExamplesSection: React.StatelessComponent<IExamplesSectionProps> =
const { className, examples, exampleKnobs, sectionName, readableSectionName, style, id } = props;
const [activeEditorTitle, setActiveEditorTitle] = React.useState('');

const handleEditorToggle = (card: string) => {
setActiveEditorTitle(card);
};

return (
<div className={className} style={style}>
<div className={styles.sectionHeader}>
Expand All @@ -32,7 +28,11 @@ export const ExamplesSection: React.StatelessComponent<IExamplesSectionProps> =
const { view, ...exampleProps } = example;
return (
<div key={example.title + '-key'} className={styles.subSection}>
<ExampleCard {...exampleProps} onToggleEditor={setActiveEditorTitle} isCodeVisible={exampleProps.title === activeEditorTitle}>
<ExampleCard
{...exampleProps}
onToggleEditor={setActiveEditorTitle}
isCodeVisible={exampleProps.title === activeEditorTitle}
>
{view}
</ExampleCard>
</div>
Expand Down

0 comments on commit 0b06f7b

Please sign in to comment.