Commit 3d8997a4 authored by boojack's avatar boojack

feat: use tailwindcss and show export btn

parent 374721fa
...@@ -18,12 +18,15 @@ ...@@ -18,12 +18,15 @@
"@typescript-eslint/eslint-plugin": "^5.6.0", "@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0", "@typescript-eslint/parser": "^5.6.0",
"@vitejs/plugin-react": "^1.0.0", "@vitejs/plugin-react": "^1.0.0",
"autoprefixer": "^10.4.2",
"eslint": "^8.4.1", "eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.27.1", "eslint-plugin-react": "^7.27.1",
"less": "^4.1.1", "less": "^4.1.1",
"postcss": "^8.4.5",
"prettier": "2.5.1", "prettier": "2.5.1",
"tailwindcss": "^3.0.18",
"typescript": "^4.3.2", "typescript": "^4.3.2",
"vite": "^2.6.14" "vite": "^2.6.14"
}, },
......
/* eslint-disable no-undef */
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
...@@ -40,13 +40,14 @@ const PreferencesSection: React.FC<Props> = () => { ...@@ -40,13 +40,14 @@ const PreferencesSection: React.FC<Props> = () => {
const handleExportBtnClick = async () => { const handleExportBtnClick = async () => {
const formatedMemos = memoService.getState().memos.map((m) => { const formatedMemos = memoService.getState().memos.map((m) => {
return { return {
...m, content: m.content,
createdAt: m.createdAt,
}; };
}); });
const jsonStr = JSON.stringify(formatedMemos); const jsonStr = JSON.stringify(formatedMemos);
const element = document.createElement("a"); const element = document.createElement("a");
element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(jsonStr)); element.setAttribute("href", "data:text/json;charset=utf-8," + encodeURIComponent(jsonStr));
element.setAttribute("download", "data.json"); element.setAttribute("download", "data.json");
element.style.display = "none"; element.style.display = "none";
document.body.appendChild(element); document.body.appendChild(element);
...@@ -94,13 +95,13 @@ const PreferencesSection: React.FC<Props> = () => { ...@@ -94,13 +95,13 @@ const PreferencesSection: React.FC<Props> = () => {
<img className="icon-img" src={useTinyUndoHistoryCache ? "/icons/checkbox-active.svg" : "/icons/checkbox.svg"} /> <img className="icon-img" src={useTinyUndoHistoryCache ? "/icons/checkbox-active.svg" : "/icons/checkbox.svg"} />
</label> </label>
</div> </div>
<div className="section-container hidden"> <div className="section-container">
<p className="title-text">其他</p> <p className="title-text">其他</p>
<div className="btn-container"> <div className="w-full flex flex-row justify-start items-center">
<button className="btn export-btn" onClick={handleExportBtnClick}> <button className="px-2 py-1 border rounded text-base hover:opacity-80" onClick={handleExportBtnClick}>
导出数据(JSON) 导出数据(JSON)
</button> </button>
<button className="btn format-btn" onClick={handleFormatMemosBtnClick}> <button className="btn format-btn hidden" onClick={handleFormatMemosBtnClick}>
格式化数据 格式化数据
</button> </button>
</div> </div>
......
@tailwind base;
@tailwind components;
@tailwind utilities;
...@@ -60,7 +60,6 @@ img { ...@@ -60,7 +60,6 @@ img {
background-color: transparent; background-color: transparent;
user-select: none; user-select: none;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
border: none;
outline: none; outline: none;
} }
......
...@@ -6,6 +6,7 @@ import appStore from "./stores/appStore"; ...@@ -6,6 +6,7 @@ import appStore from "./stores/appStore";
import App from "./App"; import App from "./App";
import "./helpers/polyfill"; import "./helpers/polyfill";
import "./less/global.less"; import "./less/global.less";
import "./css/index.css";
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
......
/* eslint-disable no-undef */
module.exports = {
content: ["./index.html", "./src/**/*.{js,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment