/
rxeev
/
react-code-editor
Обзор
Документация
Войти
/
rxeev
/
react-code-editor
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/components/CodeBar/index.js
39 строк
996 B
unknown
full
13 сен 2022, 18:04
13 сен 2022, 18:04
27c0be7
Код
Авторство
О чём код?
import React from 'react' import { Csseditor } from '../Editor/CssEditor' import { Htmleditor } from '../Editor/HtmlEditor' import { Jseditor } from '../Editor/JsEditor' import styles from './codebar.module.css' export const CodeBar = () => { const [activeTab, setActiveTab] = React.useState(0) const codes = ['HTML','CSS','JS'] const onClickCodes = (index) => { setActiveTab(index) } return ( <div className={styles.codebar}> <nav className={styles.tab}> { codes.map((e,index)=> { return <button onClick={()=> onClickCodes(index)} className={`${activeTab === index ? styles.active : ''}`} >{e}</button> }) } </nav> <div className={styles.editor}> {activeTab === 0 ? <Htmleditor/> : null} {activeTab === 1 ? <Csseditor/> : null} {activeTab === 2 ? <Jseditor/> : null} </div> </div> ) }