/* eslint-disable max-len */ import React from 'react'; import { useTranslation } from 'next-i18next'; import { PrismAsyncLight } from 'react-syntax-highlighter'; import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism'; export const Cheatsheet = (): JSX.Element => { const { t } = useTranslation(); /* * Each Element */ // Left Side const codeStr = `# ${t('sandbox.header_x', { index: '1' })}\n## ${t('sandbox.header_x', { index: '2' })}\n### ${t('sandbox.header_x', { index: '3' })}`; const codeBlockStr = 'text\n\ntext'; const lineBlockStr = 'text\ntext'; const typographyStr = `*${t('sandbox.italics')}*\n**${t('sandbox.bold')}**\n***${t('sandbox.italic_bold')}***\n~~${t('sandbox.strikethrough')}~~`; const linkStr = '[Google](https://www.google.co.jp/)'; const codeHighlightStr = '```javascript:index.js\nwriteCode();\n```'; // Right Side const codeListStr = `- ${t('sandbox.unordered_list_x', { index: '1' })} - ${t('sandbox.unordered_list_x', { index: '1.1' })} - ${t('sandbox.unordered_list_x', { index: '1.2' })}`; const orderedListStr = `1. ${t('sandbox.ordered_list_x', { index: '1' })}\n1. ${t('sandbox.ordered_list_x', { index: '2' })}`; const taskStr = `- [ ] ${t('sandbox.task')}(${t('sandbox.task_unchecked')})\n- [x] ${t('sandbox.task')}(${t('sandbox.task_checked')})`; const quoteStr = `> ${t('sandbox.quote1')}\n> ${t('sandbox.quote2')}`; const nestedQuoteStr = `>> ${t('sandbox.quote_nested')}\n>>> ${t('sandbox.quote_nested')}\n>>>> ${t('sandbox.quote_nested')}`; const tableStr = '|Left | Mid | Right|\n|:----------|:---------:|----------:|\n|col 1 | col 2 | col 3|\n|col 1 | col 2 | col 3|'; const imageStr = '![ex](https://example.com/image.png)'; const renderCheetSheetElm = (CheetSheetElm: string) => { return ( {String(CheetSheetElm).replace(/\n$/, '')} ); }; return (
{/* Header */}

{t('sandbox.header')}

{renderCheetSheetElm(codeStr)} {/* Block */}

{t('sandbox.block')}

[{t('sandbox.empty_line')}]{t('sandbox.block_detail')}

{renderCheetSheetElm(codeBlockStr)} {/* Line Break */}

{t('sandbox.line_break')}

[ ][ ] {t('sandbox.line_break_detail')}

{renderCheetSheetElm(lineBlockStr)} {/* Typography */}

{t('sandbox.typography')}

{renderCheetSheetElm(typographyStr)} {/* Link */}

{t('sandbox.link')}

{renderCheetSheetElm(linkStr)} {/* CodeHhighlight */}

{t('sandbox.code_highlight')}

{renderCheetSheetElm(codeHighlightStr)}
{/* List */}

{t('sandbox.list')}

{renderCheetSheetElm(codeListStr)} {renderCheetSheetElm(orderedListStr)} {renderCheetSheetElm(taskStr)} {/* Quote */}

{t('sandbox.quote')}

{renderCheetSheetElm(quoteStr)} {renderCheetSheetElm(nestedQuoteStr)} {/* Table */}

{t('sandbox.table')}

{renderCheetSheetElm(tableStr)} {/* Image */}

{t('sandbox.image')}

![{t('sandbox.alt_text')}](URL) {t('sandbox.insert_image')}

{renderCheetSheetElm(imageStr)}
external_link {t('sandbox.open_sandbox')}
); };