This repository has been archived by the owner on Sep 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Add Editor and Routing functionality #40
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react' | ||
import Editor from 'react-simple-code-editor'; | ||
import { highlight, languages } from 'prismjs/components/prism-core'; | ||
import 'prismjs/components/prism-clike'; | ||
import 'prismjs/components/prism-javascript'; | ||
import './Editor.scss' | ||
|
||
const code = `a { | ||
margin:10px; | ||
}`; | ||
|
||
class editor extends React.Component { | ||
|
||
state = { code }; | ||
render() {return( | ||
<div className="Container"> | ||
<Editor className="Editor" | ||
value={this.state.code} | ||
onValueChange={code => this.setState({ code })} | ||
highlight={code => highlight(code, languages.js)} | ||
padding={10} | ||
style={{ | ||
fontFamily: '"Fira code", "Fira Mono", monospace', | ||
fontSize: 20, | ||
}} | ||
/> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default editor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
|
||
|
||
.Container { | ||
padding: 10px; | ||
border-radius: 10px; | ||
} | ||
.Editor { | ||
padding: 20px; | ||
width: 50%; | ||
border-radius: 5px; | ||
} | ||
|
||
|
||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
color: #a9b7c6; | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
direction: ltr; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
line-height: 1.5; | ||
|
||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
|
||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none; | ||
} | ||
|
||
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, | ||
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { | ||
color: inherit; | ||
background: rgba(33, 66, 131, .85); | ||
} | ||
|
||
pre[class*="language-"]::selection, pre[class*="language-"] ::selection, | ||
code[class*="language-"]::selection, code[class*="language-"] ::selection { | ||
color: inherit; | ||
background: rgba(33, 66, 131, .85); | ||
} | ||
|
||
/* Code blocks */ | ||
pre[class*="language-"] { | ||
padding: 1em; | ||
margin: .5em 0; | ||
overflow: auto; | ||
} | ||
|
||
:not(pre) > code[class*="language-"], | ||
pre[class*="language-"] { | ||
background: #2b2b2b; | ||
} | ||
|
||
/* Inline code */ | ||
:not(pre) > code[class*="language-"] { | ||
padding: .1em; | ||
border-radius: .3em; | ||
} | ||
|
||
.token.comment, | ||
.token.prolog, | ||
.token.cdata { | ||
color: #808080; | ||
} | ||
|
||
.token.delimiter, | ||
.token.boolean, | ||
.token.keyword, | ||
.token.selector, | ||
.token.important, | ||
.token.atrule { | ||
color: #cc7832; | ||
} | ||
|
||
.token.operator, | ||
.token.punctuation, | ||
.token.attr-name { | ||
color: #a9b7c6; | ||
} | ||
|
||
.token.tag, | ||
.token.tag .punctuation, | ||
.token.doctype, | ||
.token.builtin { | ||
color: #e8bf6a; | ||
} | ||
|
||
.token.entity, | ||
.token.number, | ||
.token.symbol { | ||
color: #6897bb; | ||
} | ||
|
||
.token.property, | ||
.token.constant, | ||
.token.variable { | ||
color: #9876aa; | ||
} | ||
|
||
.token.string, | ||
.token.char { | ||
color: #6a8759; | ||
} | ||
|
||
.token.attr-value, | ||
.token.attr-value .punctuation { | ||
color: #a5c261; | ||
} | ||
|
||
.token.attr-value .punctuation:first-child { | ||
color: #a9b7c6; | ||
} | ||
|
||
.token.url { | ||
color: #287bde; | ||
text-decoration: underline; | ||
} | ||
|
||
.token.function { | ||
color: #ffc66d; | ||
} | ||
|
||
.token.regex { | ||
background: #364135; | ||
} | ||
|
||
.token.bold { | ||
font-weight: bold; | ||
} | ||
|
||
.token.italic { | ||
font-style: italic; | ||
} | ||
|
||
.token.inserted { | ||
background: #294436; | ||
} | ||
|
||
.token.deleted { | ||
background: #484a4a; | ||
} | ||
|
||
code.language-css .token.property, | ||
code.language-css .token.property + .token.punctuation { | ||
color: #a9b7c6; | ||
} | ||
|
||
code.language-css .token.id { | ||
color: #ffc66d; | ||
} | ||
|
||
code.language-css .token.selector > .token.class, | ||
code.language-css .token.selector > .token.attribute, | ||
code.language-css .token.selector > .token.pseudo-class, | ||
code.language-css .token.selector > .token.pseudo-element { | ||
color: #ffc66d; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually you might want to pull a lot of the css into a common file and inherit from that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is added as a property to it, I am not too sure if I can pull it out :(