mirror of https://github.com/fantasticit/think.git
tiptap: replace modal with sidesheet
This commit is contained in:
parent
51fba869e1
commit
cf18552962
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
.listWrap {
|
.listWrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 320px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { Popover, Typography, Modal } from '@douyinfe/semi-ui';
|
import { Popover, Typography, SideSheet } from '@douyinfe/semi-ui';
|
||||||
import { EXPRESSIONES, GESTURES, SYMBOLS, OBJECTS, ACTIVITIES, SKY_WEATHER } from './constants';
|
import { EXPRESSIONES, GESTURES, SYMBOLS, OBJECTS, ACTIVITIES, SKY_WEATHER } from './constants';
|
||||||
import { createKeysLocalStorageLRUCache } from 'helpers/lru-cache';
|
import { createKeysLocalStorageLRUCache } from 'helpers/lru-cache';
|
||||||
import { useToggle } from 'hooks/use-toggle';
|
import { useToggle } from 'hooks/use-toggle';
|
||||||
|
@ -61,10 +61,10 @@ export const EmojiPicker: React.FC<IProps> = ({ onSelectEmoji, children }) => {
|
||||||
|
|
||||||
const content = useMemo(
|
const content = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<div className={styles.wrap} style={{ paddingBottom: isMobile ? 24 : 0 }}>
|
<div className={styles.wrap} style={{ padding: isMobile ? '24px 0' : 0 }}>
|
||||||
{renderedList.map((item, index) => {
|
{renderedList.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<div key={item.title} className={styles.sectionWrap}>
|
<div key={item.title}>
|
||||||
<Title heading={6} style={{ margin: `${index === 0 ? 0 : 16}px 0 6px` }}>
|
<Title heading={6} style={{ margin: `${index === 0 ? 0 : 16}px 0 6px` }}>
|
||||||
{item.title}
|
{item.title}
|
||||||
</Title>
|
</Title>
|
||||||
|
@ -93,16 +93,17 @@ export const EmojiPicker: React.FC<IProps> = ({ onSelectEmoji, children }) => {
|
||||||
<span>
|
<span>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<SideSheet
|
||||||
centered
|
headerStyle={{ borderBottom: '1px solid var(--semi-color-border)' }}
|
||||||
title="表情"
|
placement="bottom"
|
||||||
|
title={'表情'}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
footer={null}
|
onCancel={toggleVisible}
|
||||||
onCancel={() => toggleVisible(false)}
|
height={370}
|
||||||
style={{ maxWidth: '96vw' }}
|
mask={false}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</Modal>
|
</SideSheet>
|
||||||
<span onMouseDown={() => toggleVisible(true)}>{children}</span>
|
<span onMouseDown={() => toggleVisible(true)}>{children}</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
@ -113,7 +114,7 @@ export const EmojiPicker: React.FC<IProps> = ({ onSelectEmoji, children }) => {
|
||||||
position="bottomLeft"
|
position="bottomLeft"
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onVisibleChange={toggleVisible}
|
onVisibleChange={toggleVisible}
|
||||||
content={content}
|
content={<div style={{ width: 320 }}>{content}</div>}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { Dropdown, Typography, Modal } from '@douyinfe/semi-ui';
|
import { Dropdown, Typography, Modal, SideSheet, Row, Col } from '@douyinfe/semi-ui';
|
||||||
import styles from './style.module.scss';
|
import styles from './style.module.scss';
|
||||||
import { useWindowSize } from 'hooks/use-window-size';
|
import { useWindowSize } from 'hooks/use-window-size';
|
||||||
import { useToggle } from 'hooks/use-toggle';
|
import { useToggle } from 'hooks/use-toggle';
|
||||||
|
@ -89,7 +89,7 @@ export const ColorPicker: React.FC<{
|
||||||
|
|
||||||
const content = useMemo(
|
const content = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<div style={{ padding: isMobile ? '0 0 24px' : '12px 16px' }}>
|
<div style={{ padding: isMobile ? '24px 0 24px' : '12px 16px', width: isMobile ? 'auto' : 272 }}>
|
||||||
<div className={styles.emptyWrap} onClick={() => onSetColor(null)}>
|
<div className={styles.emptyWrap} onClick={() => onSetColor(null)}>
|
||||||
<span></span>
|
<span></span>
|
||||||
<Text>无颜色</Text>
|
<Text>无颜色</Text>
|
||||||
|
@ -115,16 +115,17 @@ export const ColorPicker: React.FC<{
|
||||||
<span>
|
<span>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<SideSheet
|
||||||
centered
|
headerStyle={{ borderBottom: '1px solid var(--semi-color-border)' }}
|
||||||
|
placement="bottom"
|
||||||
title={title}
|
title={title}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
footer={null}
|
onCancel={toggleVisible}
|
||||||
onCancel={() => toggleVisible(false)}
|
height={284}
|
||||||
style={{ maxWidth: '96vw', width: 288 }}
|
mask={false}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</Modal>
|
</SideSheet>
|
||||||
<span style={{ display: 'inline-block' }} onMouseDown={() => toggleVisible(true)}>
|
<span style={{ display: 'inline-block' }} onMouseDown={() => toggleVisible(true)}>
|
||||||
{children}
|
{children}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
.emptyWrap {
|
.emptyWrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 240px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
|
@ -35,7 +34,6 @@
|
||||||
.colorWrap {
|
.colorWrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
width: 240px;
|
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
|
||||||
.colorItem {
|
.colorItem {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { Popover, Button, Typography, Input, Space, Modal } from '@douyinfe/semi-ui';
|
import { Popover, Button, Typography, Input, Space, SideSheet } from '@douyinfe/semi-ui';
|
||||||
import { Editor } from 'tiptap/editor';
|
import { Editor } from 'tiptap/editor';
|
||||||
import { useWindowSize } from 'hooks/use-window-size';
|
import { useWindowSize } from 'hooks/use-window-size';
|
||||||
import { useToggle } from 'hooks/use-toggle';
|
import { useToggle } from 'hooks/use-toggle';
|
||||||
|
@ -64,7 +64,7 @@ export const Search: React.FC<{ editor: Editor }> = ({ editor }) => {
|
||||||
}, [editor]);
|
}, [editor]);
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<div style={{ paddingBottom: isMobile ? 24 : 0 }}>
|
<div style={{ padding: isMobile ? '24px 0' : 0 }}>
|
||||||
<div style={{ marginBottom: 12 }}>
|
<div style={{ marginBottom: 12 }}>
|
||||||
<Text type="tertiary">查找</Text>
|
<Text type="tertiary">查找</Text>
|
||||||
<Input
|
<Input
|
||||||
|
@ -110,16 +110,17 @@ export const Search: React.FC<{ editor: Editor }> = ({ editor }) => {
|
||||||
<span>
|
<span>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<SideSheet
|
||||||
centered
|
headerStyle={{ borderBottom: '1px solid var(--semi-color-border)' }}
|
||||||
title="查找替换"
|
placement="bottom"
|
||||||
|
title={'查找替换'}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
footer={null}
|
onCancel={toggleVisible}
|
||||||
onCancel={() => toggleVisible(false)}
|
height={280}
|
||||||
style={{ maxWidth: '96vw' }}
|
mask={false}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</Modal>
|
</SideSheet>
|
||||||
{btn}
|
{btn}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Reference in New Issue