Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(flat-components): format pmi id #2060

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/flat-components/src/components/Pmi/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "./style.less";

import React, { HTMLAttributes, FC } from "react";
import { formatInviteCode } from "../../utils/room";
export * from "./PmiExistTip";

export interface PmiDescProps extends HTMLAttributes<HTMLSpanElement> {
Expand All @@ -12,7 +13,19 @@ export const PmiDesc: FC<PmiDescProps> = ({ text, pmi, ...restProps }) => {
return (
<span className="pmi" {...restProps}>
<span className="pmi-text">{text}</span>
<span className="pmi-id">{pmi}</span>
<Pmi className="pmi-id" pmi={pmi} />
</span>
);
};

export interface PmiProps extends HTMLAttributes<HTMLSpanElement> {
pmi: string;
}

export const Pmi: FC<PmiProps> = ({ pmi, ...restProps }) => {
return (
<span className="pmi-selectable" {...restProps}>
{formatInviteCode("", pmi)}
</span>
);
};
Expand Down
9 changes: 8 additions & 1 deletion packages/flat-components/src/components/Pmi/style.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
.pmi-id {
margin-left: 4px;
color: var(--grey-3);
}

.pmi-text {
margin-right: 4px;
}

.pmi-selectable {
user-select: text;
}


.flat-color-scheme-dark {
.pmi-id {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
LoginButtonProviderType,
SVGCopy,
PmiExistTip,
Pmi,
} from "flat-components";
import {
LoginPlatform,
Expand Down Expand Up @@ -200,7 +201,8 @@ export const GeneralSettingPage = observer(function GeneralSettingPage() {
<PmiExistTip title={t("pmi-help")} />
</span>

<span>{globalStore.pmi}</span>
<Pmi pmi={globalStore.pmi!} />

<Button
className="general-setting-item-btn"
type="link"
Expand Down