mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
wip
This commit is contained in:
@@ -45,24 +45,28 @@ class PermalinkPopover extends React.Component<InnerProps> {
|
||||
const { copied, showBody } = this.state;
|
||||
return (
|
||||
<Popover
|
||||
showBody={showBody}
|
||||
body={
|
||||
<div className={styles.root}>
|
||||
<TextField defaultValue={commentId} className={styles.textField} />
|
||||
<CopyToClipboard text={commentId} onCopy={this.onCopy}>
|
||||
<Button primary>
|
||||
{copied ? (
|
||||
<L id="copied">
|
||||
<span>Copied!</span>
|
||||
</L>
|
||||
) : (
|
||||
<L id="copy">
|
||||
<span>Copy</span>
|
||||
</L>
|
||||
)}
|
||||
</Button>
|
||||
</CopyToClipboard>
|
||||
</div>
|
||||
showBody ? (
|
||||
<div className={styles.root}>
|
||||
<TextField
|
||||
defaultValue={commentId}
|
||||
className={styles.textField}
|
||||
/>
|
||||
<CopyToClipboard text={commentId} onCopy={this.onCopy}>
|
||||
<Button primary>
|
||||
{copied ? (
|
||||
<L id="copied">
|
||||
<span>Copied!</span>
|
||||
</L>
|
||||
) : (
|
||||
<L id="copy">
|
||||
<span>Copy</span>
|
||||
</L>
|
||||
)}
|
||||
</Button>
|
||||
</CopyToClipboard>
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
<button className={styles.shareButton} onClick={this.onClick}>
|
||||
|
||||
@@ -3,9 +3,8 @@ import { Manager, Popper, Reference } from "react-popper";
|
||||
import * as styles from "./Popover.css";
|
||||
|
||||
interface InnerProps {
|
||||
body: React.ReactElement<any>;
|
||||
body: React.ReactElement<any> | null;
|
||||
children: React.ReactElement<any>;
|
||||
showBody: boolean;
|
||||
placement?:
|
||||
| "auto-start"
|
||||
| "auto"
|
||||
@@ -26,28 +25,27 @@ interface InnerProps {
|
||||
|
||||
class Popover extends React.Component<InnerProps> {
|
||||
public render() {
|
||||
const { children, body, placement = "top", showBody = true } = this.props;
|
||||
const { children, body, placement = "top" } = this.props;
|
||||
return (
|
||||
<Manager>
|
||||
<Reference>
|
||||
{({ ref }) => React.cloneElement(children, { ref })}
|
||||
</Reference>
|
||||
{showBody && (
|
||||
<Popper
|
||||
placement={placement}
|
||||
modifiers={{ preventOverflow: { enabled: false } }}
|
||||
eventsEnabled
|
||||
positionFixed={false}
|
||||
>
|
||||
{({ ref, style }) =>
|
||||
React.cloneElement(body, {
|
||||
ref,
|
||||
style,
|
||||
className: styles.root,
|
||||
})
|
||||
}
|
||||
</Popper>
|
||||
)}
|
||||
|
||||
<Popper
|
||||
placement={placement}
|
||||
modifiers={{ preventOverflow: { enabled: false } }}
|
||||
eventsEnabled
|
||||
positionFixed={false}
|
||||
>
|
||||
{({ ref, style }) =>
|
||||
React.cloneElement(body, {
|
||||
ref,
|
||||
style,
|
||||
className: styles.root,
|
||||
})
|
||||
}
|
||||
</Popper>
|
||||
</Manager>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user