diff options
author | eug-vs <eug-vs@keemail.me> | 2020-04-18 21:01:34 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-04-18 21:01:34 +0300 |
commit | f4f8689631d247f0be93c2f32791c9ba02ecb64e (patch) | |
tree | 47c0ae5c97ce5e7f834adfd800e0e77c968da4f6 | |
parent | 8e4a483fb7d1ebdfc950c1cc456ae2d4bd558147 (diff) | |
download | react-benzin-f4f8689631d247f0be93c2f32791c9ba02ecb64e.tar.gz |
style: fix index.tsx
-rw-r--r-- | .eslintrc.json | 12 | ||||
-rw-r--r-- | src/index.tsx | 21 |
2 files changed, 17 insertions, 16 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 5e44a20..c86a906 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,13 +11,13 @@ "rules": { "jsx-quotes": ["error", "prefer-double"], "quotes": ["error", "single"], - "react/prop-types": 0, - "react/no-children-prop": 0, - "react/no-danger": 0, + "no-multiple-empty-lines": [2, { "max": 2, "maxEOF": 1 } ], + "max-len": ["error", { "code": 120 }], + "arrow-parens": [2, "as-needed"], "arrow-body-style": 0, "no-cond-assign": 0, - "arrow-parens": [2, "as-needed"], - "no-multiple-empty-lines": [2, { "max": 2, "maxEOF": 1 } ], - "max-len": ["error", { "code": 120 }] + "react/prop-types": 0, + "react/no-children-prop": 0, + "react/no-danger": 0 } } diff --git a/src/index.tsx b/src/index.tsx index ac7bfc2..c5e1989 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -96,7 +96,8 @@ const LivePreviewPage: React.FC<LivePropTypes> = ({ setLivePreviewData }) => { <> <ContentSection sectionName="Markdown live preview" level={2}> <p> - Start typing and see your text rendered on the left window! We recommend starting with # Header. + Start typing and see your text rendered on the left window! + We recommend starting with # Header. </p> <p> <TextField @@ -127,6 +128,7 @@ const App: React.FC = () => { const url = pageMap[page]; const fileName = url?.slice(url.lastIndexOf('/') + 1); const info = [ + /* eslint-disable max-len */ `## Markdown\n [Markdown file](${url}) *(...${fileName})* that you can see on the left was parsed and rendered by **BENZIN**! :rocket:`, 'Switch between tabs on the header to explore other markdown templates. :recycle: ', 'Currently **only core features** of markdown function.', @@ -137,8 +139,15 @@ const App: React.FC = () => { 'const data = \'# Header\\nHello, *world!*\';', 'ReactDOM.render(<Markdown data={data}/>, document.getElementById(\'root\'));', '```', + /* eslint-enable max-len */ ].join('\n'); + let primaryWindowContent = <Markdown url={url} />; + if (page === 'custom') primaryWindowContent = <CustomPage />; + else if (page === 'live preview') { + primaryWindowContent = <Markdown data={livePreviewData || '# Start typing in the right window!'} />; + } + return ( <Benzin> <Header @@ -151,15 +160,7 @@ const App: React.FC = () => { setPage={setPage} /> <Window type="primary"> - <div className={classes.window}> - { - (page === 'custom') - ? <CustomPage /> - : (page === 'live preview') - ? <Markdown data={livePreviewData || '# Start typing in the right window!'} /> - : <Markdown url={url} /> - } - </div> + <div className={classes.window}>{primaryWindowContent}</div> </Window> <Window type="secondary" name="Feature preview"> <div className={classes.window}> |