Skip to content

Commit

Permalink
优化文件夹
Browse files Browse the repository at this point in the history
  • Loading branch information
027xiguapi committed Sep 11, 2024
1 parent b406ac3 commit ca5bd4e
Show file tree
Hide file tree
Showing 22 changed files with 175 additions and 101 deletions.
12 changes: 9 additions & 3 deletions component/51cto.tsx → component/options/51cto.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -56,11 +56,17 @@ export default function Cto51() {
className="codebox-switch"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}{" "}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
12 changes: 9 additions & 3 deletions component/baidu.tsx → component/options/baidu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -38,11 +38,17 @@ export default function Baidu() {
<label className="codebox-switch" htmlFor="baidu-closeAIBox"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
12 changes: 9 additions & 3 deletions component/cnblogs.tsx → component/options/cnblogs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -38,11 +38,17 @@ export default function Cnblogs() {
<label className="codebox-switch" htmlFor="cnblogs-copyCode"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
File renamed without changes.
28 changes: 14 additions & 14 deletions component/content.tsx → component/options/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import React, { useEffect, useState } from "react"

import { sendToContentScript } from "@plasmohq/messaging"

import Cto51 from "~component/51cto"
import Baidu from "~component/baidu"
import Cnblogs from "~component/cnblogs"
import Config from "~component/config"
import Csdn from "~component/csdn"
import Custom from "~component/custom"
import Jb51 from "~component/jb51"
import Jianshu from "~component/jianshu"
import Juejin from "~component/juejin"
import Oschina from "~component/oschina"
import Php from "~component/php"
import Segmentfault from "~component/segmentfault"
import Weixin from "~component/weixin"
import Zhihu from "~component/zhihu"
import Cto51 from "~component/options/51cto"
import Baidu from "~component/options/baidu"
import Cnblogs from "~component/options/cnblogs"
import Config from "~component/options/config"
import Csdn from "~component/options/csdn"
import Custom from "~component/options/custom"
import Jb51 from "~component/options/jb51"
import Jianshu from "~component/options/jianshu"
import Juejin from "~component/options/juejin"
import Oschina from "~component/options/oschina"
import Php from "~component/options/php"
import Segmentfault from "~component/options/segmentfault"
import Weixin from "~component/options/weixin"
import Zhihu from "~component/options/zhihu"

export default function Content() {
const [csdnIsShow, setCsdnIsShow] = useState<boolean>(false)
Expand Down
12 changes: 9 additions & 3 deletions component/csdn.tsx → component/options/csdn.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined, HeartTwoTone } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -136,11 +136,17 @@ export default function Csdn() {
className="codebox-switch"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
4 changes: 3 additions & 1 deletion component/custom.tsx → component/options/custom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export default function Custom() {
const [codes, setCodes] = useState([])

useEffect(() => {
getCodes()
if (window.location.protocol != "chrome-extension:") {
getCodes()
}
}, [])

async function getCodes() {
Expand Down
12 changes: 9 additions & 3 deletions component/jb51.tsx → component/options/jb51.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -53,11 +53,17 @@ export default function Jb51() {
<label className="codebox-switch" htmlFor="jb51-copyCode"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
12 changes: 9 additions & 3 deletions component/jianshu.tsx → component/options/jianshu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -74,11 +74,17 @@ export default function Jianshu() {
htmlFor="jianshu-autoOpenCode"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
12 changes: 9 additions & 3 deletions component/juejin.tsx → component/options/juejin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"

Expand All @@ -21,11 +21,17 @@ export default function Juejin() {
<fieldset>
<legend>{i18n("juejinConfig")}</legend>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
12 changes: 9 additions & 3 deletions component/oschina.tsx → component/options/oschina.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"

Expand All @@ -21,11 +21,17 @@ export default function Oschina() {
<fieldset>
<legend>{i18n("oschinaConfig")}</legend>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
12 changes: 9 additions & 3 deletions component/php.tsx → component/options/php.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/hook"
Expand Down Expand Up @@ -54,11 +54,17 @@ export default function Php() {
<label htmlFor="php-closeLoginModal" className="codebox-switch"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"

Expand All @@ -21,11 +21,17 @@ export default function Segmentfault() {
<fieldset>
<legend>{i18n("segmentfaultConfig")}</legend>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
41 changes: 41 additions & 0 deletions component/options/sortableItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useSortable } from "@dnd-kit/sortable"
import { CSS } from "@dnd-kit/utilities"
import React from "react"

import Cto51 from "~component/options/51cto"
import Baidu from "~component/options/baidu"
import Cnblogs from "~component/options/cnblogs"
import Config from "~component/options/config"
import Csdn from "~component/options/csdn"
import Custom from "~component/options/custom"
import Jb51 from "~component/options/jb51"
import Jianshu from "~component/options/jianshu"
import Juejin from "~component/options/juejin"
import Oschina from "~component/options/oschina"
import Php from "~component/options/php"
import Segmentfault from "~component/options/segmentfault"
import Weixin from "~component/options/weixin"
import Zhihu from "~component/options/zhihu"

const itemMap = {
csdn: <Csdn />,
zhihu: <Zhihu />,
baidu: <Baidu />,
juejin: <Juejin />,
oschina: <Oschina />,
jianshu: <Jianshu />,
jb51: <Jb51 />,
cnblogs: <Cnblogs />,
"51cto": <Cto51 />,
php: <Php />,
segmentfault: <Segmentfault />,
weixin: <Weixin />,
custom: <Custom />,
app: <Config />
}

export default function SortableItem(props) {
const { item } = props

return <div className="sortableItem">{itemMap[item.value]}</div>
}
12 changes: 9 additions & 3 deletions component/weixin.tsx → component/options/weixin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadOutlined } from "@ant-design/icons"
import { DownloadOutlined, StarTwoTone } from "@ant-design/icons"

import { sendToContentScript } from "@plasmohq/messaging"
import { useStorage } from "@plasmohq/storage/dist/hook"
Expand Down Expand Up @@ -38,11 +38,17 @@ export default function Weixin() {
<label className="codebox-switch" htmlFor="weixin-copyCode"></label>
</div>
<div className="item download" onClick={downloadMarkdown}>
{i18n("downloadMarkdown")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadMarkdown")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
<div className="item download" onClick={downloadHtml}>
{i18n("downloadHtml")}
<span>
<StarTwoTone twoToneColor="#eb2f96" style={{ marginRight: "5px" }} />
{i18n("downloadHtml")}
</span>
<DownloadOutlined style={{ color: "#52c41a", fontSize: "16px" }} />
</div>
</fieldset>
Expand Down
Loading

0 comments on commit ca5bd4e

Please sign in to comment.