Skip to content

Commit

Permalink
fix: viewStyle default to tags
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Feb 24, 2020
1 parent 89d7266 commit 6a523b1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions blocks/core/src/Source/Source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ export const Source: FC<SourceProps> = ({
parentTheme || 'nightowl-light',
);

const [viewStyle, setViewStyle] = React.useState<ViewStyle>(
!!controls && !!args ? 'values' : 'tags',
);
const [viewStyle, setViewStyle] = React.useState<ViewStyle>('tags');
const [showFileSource, setShowFileSource] = React.useState<boolean>(false);

let prismTheme = themes[themeName] || defaultProps.theme;
Expand All @@ -113,7 +111,7 @@ export const Source: FC<SourceProps> = ({
setViewStyle(
viewStyle === 'plain'
? 'tags'
: viewStyle === 'tags'
: viewStyle === 'tags' && !!controls && !!args
? 'values'
: 'plain',
);
Expand All @@ -136,7 +134,7 @@ export const Source: FC<SourceProps> = ({
if (parentTheme === undefined) {
actions.push({ title: themeName, onClick: onRotateTheme });
}
if (controls && args) {
if (args) {
actions.push({ title: viewStyle, onClick: onMergeValues });
}

Expand Down

0 comments on commit 6a523b1

Please sign in to comment.