-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
13,085 additions
and
662 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
presets: [process.env.PLATFORM_ENV === "react" ? "react-app" : "@vue/app"] | ||
}; | ||
presets: [process.env.PLATFORM_ENV === 'react' ? 'react-app' : '@vue/app'] | ||
} |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const path = require('path') | ||
const fs = require('fs') | ||
|
||
const appDirectory = fs.realpathSync(process.cwd()); | ||
const resolveApp = relativePath => path.resolve(appDirectory, relativePath); | ||
const appDirectory = fs.realpathSync(process.cwd()) | ||
const resolveApp = relativePath => path.resolve(appDirectory, relativePath) | ||
|
||
module.exports = { | ||
paths: function(paths, env) { | ||
paths.appBuild = resolveApp("dist/react"); | ||
paths.appHtml = resolveApp("public/react.html"); | ||
return paths; | ||
paths.appBuild = resolveApp('dist/react') | ||
paths.appHtml = resolveApp('public/react.html') | ||
return paths | ||
} | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,36 +1,32 @@ | ||
var express = require("express"); | ||
var compression = require("compression"); | ||
var http = require("http"); | ||
var path = require("path"); | ||
var portrange = 8090; | ||
var app = express(); | ||
var express = require('express') | ||
var compression = require('compression') | ||
var http = require('http') | ||
var path = require('path') | ||
var portrange = 8090 | ||
var app = express() | ||
|
||
app.use(compression()); | ||
app.use("/", express.static(path.resolve(__dirname, "./dist/"))); | ||
app.use(compression()) | ||
app.use('/', express.static(path.resolve(__dirname, './dist/'))) | ||
|
||
function getPort(cb) { | ||
var port = portrange; | ||
portrange += 1; | ||
var port = portrange | ||
portrange += 1 | ||
|
||
var server = http.createServer(); | ||
var server = http.createServer() | ||
server.listen(port, function() { | ||
server.once("close", function() { | ||
cb(port); | ||
}); | ||
server.close(); | ||
}); | ||
server.on("error", function() { | ||
getPort(cb); | ||
}); | ||
server.once('close', function() { | ||
cb(port) | ||
}) | ||
server.close() | ||
}) | ||
server.on('error', function() { | ||
getPort(cb) | ||
}) | ||
} | ||
|
||
getPort(function(port) { | ||
app.listen(port, function() { | ||
require("child_process").exec( | ||
"start chrome http://localhost:" + port + "/vue" | ||
); | ||
require("child_process").exec( | ||
"start chrome http://localhost:" + port + "/react" | ||
); | ||
}); | ||
}); | ||
require('child_process').exec('start chrome http://localhost:' + port + '/vue') | ||
require('child_process').exec('start chrome http://localhost:' + port + '/react') | ||
}) | ||
}) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,72 +1,47 @@ | ||
import React, { useState } from "react"; | ||
import { changeTheme, supportCssVars, enableCssVars, themeVars } from "./theme"; | ||
import Todo from "./views/Todo"; | ||
import tagVars from "./theme/Tag"; | ||
import todoVars from "./theme/Todo"; | ||
import "./style/app.scss"; | ||
import React, { useState } from 'react' | ||
import { changeTheme, supportCssVars, enableCssVars, themeVars } from './theme' | ||
import Todo from './views/Todo' | ||
import tagVars from './theme/Tag' | ||
import todoVars from './theme/Todo' | ||
import './style/app.scss' | ||
|
||
export default () => { | ||
const [todoColor, setTodoColor] = useState(() => | ||
themeVars(Object.keys(todoVars)[0]) | ||
); | ||
const [tagColor, setTagColor] = useState(() => | ||
themeVars(Object.keys(tagVars)[0]) | ||
); | ||
const [fontSize, setFontSize] = useState(() => themeVars("aui-font-size")); | ||
const [theme, setTheme] = useState(themeVars()); | ||
const [title] = useState("New Tag"); | ||
const [todoColor, setTodoColor] = useState(() => themeVars(Object.keys(todoVars)[0])) | ||
const [tagColor, setTagColor] = useState(() => themeVars(Object.keys(tagVars)[0])) | ||
const [fontSize, setFontSize] = useState(() => themeVars('aui-font-size')) | ||
const [theme, setTheme] = useState(themeVars()) | ||
const [title] = useState('New Tag') | ||
|
||
const change = e => { | ||
const apply = () => { | ||
const { name, value } = e.target; | ||
const { name, value } = e.target | ||
|
||
name === "aui-tag-color" && setTagColor(value); | ||
name === "aui-todo-color" && setTodoColor(value); | ||
name === "aui-font-size" && setFontSize(value); | ||
name === 'aui-tag-color' && setTagColor(value) | ||
name === 'aui-todo-color' && setTodoColor(value) | ||
name === 'aui-font-size' && setFontSize(value) | ||
|
||
setTheme(Object.assign(theme, { [name]: value })); | ||
changeTheme(theme); | ||
}; | ||
setTheme(Object.assign(theme, { [name]: value })) | ||
changeTheme(theme) | ||
} | ||
|
||
if ( | ||
!supportCssVars() && | ||
window.confirm("当前浏览器不支持主题切换,要启用兼容程序吗?") | ||
) { | ||
enableCssVars().then(apply); | ||
if (!supportCssVars() && window.confirm('当前浏览器不支持主题切换,要启用兼容程序吗?')) { | ||
enableCssVars().then(apply) | ||
} else { | ||
apply(); | ||
apply() | ||
} | ||
}; | ||
} | ||
|
||
return ( | ||
<div id="app"> | ||
<div id="nav"> | ||
<span>更改 Tag 颜色 </span> | ||
<input | ||
name="aui-tag-color" | ||
type="color" | ||
size="4" | ||
value={tagColor} | ||
onChange={change} | ||
/> | ||
<input name="aui-tag-color" type="color" size="4" value={tagColor} onChange={change} /> | ||
<span>更改 {title} 颜色 </span> | ||
<input | ||
name="aui-todo-color" | ||
type="color" | ||
size="4" | ||
value={todoColor} | ||
onChange={change} | ||
/> | ||
<input name="aui-todo-color" type="color" size="4" value={todoColor} onChange={change} /> | ||
<span>更改字体大小 </span> | ||
<input | ||
name="aui-font-size" | ||
type="text" | ||
size="2" | ||
value={fontSize} | ||
onChange={change} | ||
/> | ||
<input name="aui-font-size" type="text" size="2" value={fontSize} onChange={change} /> | ||
</div> | ||
<Todo /> | ||
</div> | ||
); | ||
}; | ||
) | ||
} |
Oops, something went wrong.