Skip to content

Commit 34abee8

Browse files
committed
fix: 点击复制会触发Collapse toggle
1 parent 27e75c1 commit 34abee8

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

src/App.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React, { useState } from "react";
1+
import React, { useState, Fragment } from "react";
22
import { Tabs, Tag, Button, Table, Empty, message, Collapse } from "antd";
33
import marked from "marked";
44
import hljs from "highlight.js";
55
import "highlight.js/styles/github.css";
66

77
import { copy } from "./utils";
88
import db from "./db/db";
9-
import { LEETCODE_CN_URL, LEETCODE_URL } from "./constant/index";
9+
import { LEETCODE_CN_URL, LEETCODE_URL, ISSUES_URL } from "./constant/index";
1010

1111
import "antd/dist/antd.css";
1212
import "./App.css";
@@ -118,7 +118,13 @@ function App() {
118118
</TabPane>
119119
<TabPane tab="关键点" key="1">
120120
{problems[problemId].keyPoints.map(({ id, link, text, color }) => (
121-
<TagOrLink key={text} text={text} link={link} color={color} />
121+
<TagOrLink
122+
key={text}
123+
text={text}
124+
link={link}
125+
color={color}
126+
style={{ marginBottom: 6 }}
127+
/>
122128
))}
123129
</TabPane>
124130
<TabPane tab="题解" key="2">
@@ -147,11 +153,12 @@ function App() {
147153
<Button
148154
type="primary"
149155
size="small"
150-
onClick={() =>
156+
onClick={(e) => {
157+
e.stopPropagation();
151158
copy(c.text, () => {
152159
message.success("复制成功~");
153-
})
154-
}
160+
});
161+
}}
155162
>
156163
复制
157164
</Button>
@@ -187,7 +194,14 @@ function App() {
187194
</div>
188195
</TabPane>
189196
<TabPane tab="公司" key="4">
190-
{problems[problemId].company.map((c) => c.name).join(",")}
197+
{problems[problemId].company.map((c) => c.name).join(",") || (
198+
<Fragment>
199+
暂无公司资料,
200+
<a href={ISSUES_URL} target="_blank">
201+
点击反馈
202+
</a>
203+
</Fragment>
204+
)}
191205
</TabPane>
192206
<TabPane
193207
tab="可视化调试(敬请期待)"

src/constant/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export const LEETCODE_CN_URL = "https://leetcode-cn.com";
22
export const LEETCODE_URL = "https://leetcode.com";
3+
export const ISSUES_URL = "https://github.com/azl397985856/leetcode/issues/";

src/index.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@ code {
1111
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
1212
monospace;
1313
}
14-
a {
15-
color: #000;
16-
text-decoration: none;
17-
}

0 commit comments

Comments
 (0)