mirror of
https://github.com/usememos/memos.git
synced 2024-12-19 09:02:49 +03:00
chore: update selector style
This commit is contained in:
parent
e9d303326f
commit
9f3f730723
@ -243,9 +243,19 @@ const MemoEditor: React.FC<Props> = () => {
|
|||||||
<div className="action-btn tag-action">
|
<div className="action-btn tag-action">
|
||||||
<Icon.Hash className="icon-img" />
|
<Icon.Hash className="icon-img" />
|
||||||
<div ref={tagSeletorRef} className="tag-list" onClick={handleTagSeletorClick}>
|
<div ref={tagSeletorRef} className="tag-list" onClick={handleTagSeletorClick}>
|
||||||
{tags.map((t) => {
|
{tags.length > 0 ? (
|
||||||
return <span key={t}>{t}</span>;
|
tags.map((tag) => {
|
||||||
})}
|
return (
|
||||||
|
<span className="item-container" key={tag}>
|
||||||
|
{tag}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
) : (
|
||||||
|
<p className="tip-text" onClick={(e) => e.stopPropagation()}>
|
||||||
|
{t("common.null")}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button className="action-btn">
|
<button className="action-btn">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { memo, useEffect, useRef } from "react";
|
import { memo, useEffect, useRef } from "react";
|
||||||
|
import useI18n from "../../hooks/useI18n";
|
||||||
import useToggle from "../../hooks/useToggle";
|
import useToggle from "../../hooks/useToggle";
|
||||||
import Icon from "../Icon";
|
import Icon from "../Icon";
|
||||||
import "../../less/common/selector.less";
|
import "../../less/common/selector.less";
|
||||||
@ -22,6 +23,7 @@ const nullItem = {
|
|||||||
|
|
||||||
const Selector: React.FC<Props> = (props: Props) => {
|
const Selector: React.FC<Props> = (props: Props) => {
|
||||||
const { className, dataSource, handleValueChanged, value } = props;
|
const { className, dataSource, handleValueChanged, value } = props;
|
||||||
|
const { t } = useI18n();
|
||||||
const [showSelector, toggleSelectorStatus] = useToggle(false);
|
const [showSelector, toggleSelectorStatus] = useToggle(false);
|
||||||
|
|
||||||
const seletorElRef = useRef<HTMLDivElement>(null);
|
const seletorElRef = useRef<HTMLDivElement>(null);
|
||||||
@ -70,19 +72,23 @@ const Selector: React.FC<Props> = (props: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={`items-wrapper ${showSelector ? "" : "!hidden"}`}>
|
<div className={`items-wrapper ${showSelector ? "" : "!hidden"}`}>
|
||||||
{dataSource.map((d) => {
|
{dataSource.length > 0 ? (
|
||||||
return (
|
dataSource.map((d) => {
|
||||||
<div
|
return (
|
||||||
className={`item-container ${d.value === value ? "selected" : ""}`}
|
<div
|
||||||
key={d.value}
|
className={`item-container ${d.value === value ? "selected" : ""}`}
|
||||||
onClick={() => {
|
key={d.value}
|
||||||
handleItemClick(d);
|
onClick={() => {
|
||||||
}}
|
handleItemClick(d);
|
||||||
>
|
}}
|
||||||
{d.text}
|
>
|
||||||
</div>
|
{d.text}
|
||||||
);
|
</div>
|
||||||
})}
|
);
|
||||||
|
})
|
||||||
|
) : (
|
||||||
|
<p className="tip-text">{t("common.null")}</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -39,5 +39,9 @@
|
|||||||
color: @text-green;
|
color: @text-green;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .tip-text {
|
||||||
|
@apply px-3 py-1 text-sm text-gray-600;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,13 @@
|
|||||||
> .tag-list {
|
> .tag-list {
|
||||||
@apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-1 rounded w-32 max-h-52 overflow-auto bg-black;
|
@apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-1 rounded w-32 max-h-52 overflow-auto bg-black;
|
||||||
|
|
||||||
> span {
|
> .item-container {
|
||||||
@apply w-full text-white cursor-pointer rounded text-sm leading-6 px-2 hover:bg-gray-700;
|
@apply w-full text-white cursor-pointer rounded text-sm leading-6 px-2 hover:bg-gray-700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .tip-text {
|
||||||
|
@apply w-full text-sm text-gray-200 leading-6 px-2 cursor-default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"restore": "Restore",
|
"restore": "Restore",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
|
"null": "Null",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
"mark": "Mark",
|
"mark": "Mark",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"edit": "编辑",
|
"edit": "编辑",
|
||||||
"restore": "恢复",
|
"restore": "恢复",
|
||||||
"delete": "删除",
|
"delete": "删除",
|
||||||
|
"null": "空",
|
||||||
"share": "分享",
|
"share": "分享",
|
||||||
"mark": "标注",
|
"mark": "标注",
|
||||||
"archive": "归档",
|
"archive": "归档",
|
||||||
|
Loading…
Reference in New Issue
Block a user