Skip to content

Commit 74a43a8

Browse files
committed
Update demo styles
1 parent 5163e59 commit 74a43a8

File tree

6 files changed

+41
-44
lines changed

6 files changed

+41
-44
lines changed

demo/client/components/DemoEditor/index.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import 'prismjs/components/prism-perl';
2020
import 'prismjs/components/prism-ruby';
2121
import 'prismjs/components/prism-swift';
2222
import createPrismPlugin from 'draft-js-prism-plugin';
23-
import styles from './styles.css';
2423
import createMarkdownShortcutsPlugin from '../../../..'; // eslint-disable-line
24+
import styled from 'styled-components';
2525

2626
const prismPlugin = createPrismPlugin({
2727
prism: Prism,
@@ -58,12 +58,12 @@ export default class DemoEditor extends Component {
5858
render() {
5959
const { editorState } = this.state;
6060
const placeholder = editorState.getCurrentContent().hasText() ? null : (
61-
<div className={styles.placeholder}>Write something here...</div>
61+
<Placeholder>Write something here...</Placeholder>
6262
);
6363
return (
64-
<div className={styles.root}>
64+
<Root>
6565
{placeholder}
66-
<div className={styles.editor} onClick={this.focus} onKeyDown={this.focus}>
66+
<EditorContainer onClick={this.focus} onKeyDown={this.focus}>
6767
<Editor
6868
editorState={editorState}
6969
onChange={this.onChange}
@@ -73,8 +73,29 @@ export default class DemoEditor extends Component {
7373
this.editor = element;
7474
}}
7575
/>
76-
</div>
77-
</div>
76+
</EditorContainer>
77+
</Root>
7878
);
7979
}
8080
}
81+
82+
const Root = styled.div`
83+
background: #fff;
84+
height: 100%;
85+
position: relative;
86+
`;
87+
88+
const Placeholder = styled.div`
89+
color: #ccc;
90+
font-size: 1em;
91+
position: absolute;
92+
width: 95%;
93+
top: 0;
94+
left: 2.5%;
95+
`;
96+
97+
const EditorContainer = styled.div`
98+
margin: 2.5% auto 0 auto;
99+
height: 95%;
100+
width: 95%;
101+
`;

demo/client/components/DemoEditor/styles.css

Lines changed: 0 additions & 20 deletions
This file was deleted.

demo/publicTemplate/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
<title>draft-js-markdown-shortcuts-plugin Demo</title>
88
<link rel="stylesheet" href="./css/normalize.css"/>
99
<link rel="stylesheet" href="./css/base.css"/>
10-
<link rel="stylesheet" href="./css/Draft.css"/>
1110
<link rel="stylesheet" href="./css/prism.css"/>
1211
<link rel="stylesheet" href="./css/CheckableListItem.css"/>
13-
<link rel="stylesheet" href="./app.css"/>
1412
<link href="https://fonts.googleapis.com/css?family=Open+Sans:700,300,700i,300i" rel="stylesheet" type="text/css"/>
1513
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
1614
<link href="//cdn-images.mailchimp.com/embedcode/horizontal-slim-10_7.css" rel="stylesheet" type="text/css" />

demo/webpack.config.dev.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ module.exports = {
1616
exclude: /node_modules/,
1717
loader: 'babel-loader',
1818
},
19-
{
20-
test: /\.css$/,
21-
use: ['style-loader', 'css-loader', 'postcss-loader'],
22-
},
2319
],
2420
},
2521
devServer: {

demo/webpack.config.prod.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ module.exports = {
1616
exclude: /node_modules/,
1717
loader: 'babel-loader',
1818
},
19-
{
20-
test: /\.css$/,
21-
use: ['style-loader', 'css-loader', 'postcss-loader'],
22-
},
2319
],
2420
},
25-
devServer: {
26-
contentBase: [path.join(__dirname, 'public'), path.join(__dirname, 'publicTemplate')],
27-
port: process.env.PORT || 3001,
28-
},
2921
};

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"prepare": "npm run build",
1313
"prepublish": "npm run build",
1414
"start": "npm run start:dev",
15-
"start:dev": "node_modules/.bin/babel-node ./demo/server.js",
15+
"start:dev": "webpack-dev-server --config demo/webpack.config.dev.js",
1616
"test": "npm run test:coverage",
1717
"test:coverage": "node_modules/.bin/nyc --require @babel/register npm run test:mocha",
1818
"test:mocha": "BABEL_ENV=test mocha",
@@ -22,14 +22,21 @@
2222
},
2323
"watch": {
2424
"test": {
25-
"patterns": ["src/**/*.js"]
25+
"patterns": [
26+
"src/**/*.js"
27+
]
2628
}
2729
},
2830
"repository": {
2931
"type": "git",
3032
"url": "git+https://github.com/ngs/draft-js-markdown-shortcuts-plugin.git"
3133
},
32-
"keywords": ["draftjs", "editor", "plugin", "markdown"],
34+
"keywords": [
35+
"draftjs",
36+
"editor",
37+
"plugin",
38+
"markdown"
39+
],
3340
"author": "Atsushi Nagase",
3441
"license": "MIT",
3542
"bugs": {
@@ -91,6 +98,7 @@
9198
"sinon": "^9.0.2",
9299
"sinon-chai": "^3.5.0",
93100
"style-loader": "^1.2.1",
101+
"styled-components": "^5.1.1",
94102
"url-loader": "^4.1.0",
95103
"webpack": "~4.43.0",
96104
"webpack-cli": "^3.3.11",
@@ -101,7 +109,9 @@
101109
"react": "^16.13.1",
102110
"react-dom": "^16.13.1"
103111
},
104-
"contributors": ["Atsushi Nagase <a@ngs.io>"],
112+
"contributors": [
113+
"Atsushi Nagase <a@ngs.io>"
114+
],
105115
"dependencies": {
106116
"decorate-component-with-props": "^1.1.0",
107117
"draft-js": "~0.11.5",

0 commit comments

Comments
 (0)