mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
preparing add topic buttons
This commit is contained in:
parent
cdaf4e03d1
commit
d21bbaf349
@ -1,21 +1,53 @@
|
||||
import { AddTopicWrapper } from './AddTopic.styled';
|
||||
import { useAddTopic } from './useAddTopic.hook';
|
||||
import { Input } from 'antd';
|
||||
import { Input, Menu, Dropdown } from 'antd';
|
||||
import { useRef, useState } from 'react';
|
||||
import { FontColorsOutlined, FontSizeOutlined, PaperClipOutlined, SendOutlined } from '@ant-design/icons';
|
||||
import { SketchPicker } from "react-color";
|
||||
|
||||
export function AddTopic() {
|
||||
|
||||
const [hint, setHint] = useState("send");
|
||||
const msg = useRef();
|
||||
const { state, actions } = useAddTopic();
|
||||
|
||||
const msg = useRef();
|
||||
const keyDown = (e) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
msg.current.blur();
|
||||
console.log("SEND");
|
||||
}
|
||||
}
|
||||
|
||||
const picker = (
|
||||
<Menu style={{ backgroundColor: 'unset', boxShadow: 'unset' }}>
|
||||
<SketchPicker disableAlpha={true}
|
||||
color={state.textColor}
|
||||
onChange={(color) => {
|
||||
actions.setTextColor(color.hex);
|
||||
}} />
|
||||
</Menu>
|
||||
);
|
||||
|
||||
const sizer = (
|
||||
<Menu>
|
||||
<Menu.Item key={8}><div onClick={() => actions.setTextSize(8)}>Small</div></Menu.Item>
|
||||
<Menu.Item key={14}><div onClick={() => actions.setTextSize(14)}>Medium</div></Menu.Item>
|
||||
<Menu.Item key={20}><div onClick={() => actions.setTextSize(20)}>Large</div></Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
const attacher = (
|
||||
<Menu>
|
||||
<Menu.Item key="0">
|
||||
<div>Add Image</div>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="1">
|
||||
<div>Add Video</div>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="2">
|
||||
<div>Add Audio</div>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
return (
|
||||
<AddTopicWrapper>
|
||||
<div class="carousel"></div>
|
||||
@ -24,9 +56,21 @@ export function AddTopic() {
|
||||
autocapitalize="none" enterkeyhint="send" onKeyDown={(e) => keyDown(e)} />
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div class="button space"><PaperClipOutlined /></div>
|
||||
<div class="button space"><FontSizeOutlined /></div>
|
||||
<div class="button space"><FontColorsOutlined /></div>
|
||||
<div class="button space">
|
||||
<Dropdown overlay={attacher} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="topLeft">
|
||||
<PaperClipOutlined />
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="button space">
|
||||
<Dropdown overlay={sizer} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="topLeft">
|
||||
<FontSizeOutlined />
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="button space">
|
||||
<Dropdown overlay={picker} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="topLeft">
|
||||
<FontColorsOutlined />
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="end">
|
||||
<div class="button"><SendOutlined /></div>
|
||||
</div>
|
||||
|
@ -9,6 +9,9 @@ export function useAddTopic() {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
setTextColor: (textColor) => {
|
||||
updateState({ textColor });
|
||||
},
|
||||
};
|
||||
|
||||
return { state, actions };
|
||||
|
Loading…
Reference in New Issue
Block a user