mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-05-21 09:22:01 +00:00
Basic message input for feeds
This commit is contained in:
parent
5ed65c9ff1
commit
07e41a7ea3
45
src/components/feeds/MessageInput.js
Normal file
45
src/components/feeds/MessageInput.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { InputTextarea } from 'primereact/inputtextarea';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { Panel } from 'primereact/panel';
|
||||||
|
|
||||||
|
const MessageInput = ({ collapsed, onToggle }) => {
|
||||||
|
const [message, setMessage] = useState('');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Panel header={null} toggleable collapsed={collapsed} onToggle={onToggle} className="w-full" pt={{
|
||||||
|
header: {
|
||||||
|
className: 'bg-transparent',
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
|
toggler: {
|
||||||
|
className: 'bg-transparent',
|
||||||
|
border: 'none',
|
||||||
|
},
|
||||||
|
togglerIcon: {
|
||||||
|
display: 'none',
|
||||||
|
},
|
||||||
|
}}>
|
||||||
|
<div className="w-full flex flex-col">
|
||||||
|
<InputTextarea
|
||||||
|
value={message}
|
||||||
|
onChange={(e) => setMessage(e.target.value)}
|
||||||
|
rows={5}
|
||||||
|
cols={30}
|
||||||
|
autoResize
|
||||||
|
placeholder="Type your message here..."
|
||||||
|
className="w-full"
|
||||||
|
/>
|
||||||
|
<div className="w-full flex flex-row justify-end">
|
||||||
|
<Button
|
||||||
|
label="Send"
|
||||||
|
icon="pi pi-send"
|
||||||
|
className='mt-2'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Panel>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MessageInput;
|
@ -7,16 +7,17 @@ import DiscordFeed from '@/components/feeds/DiscordFeed';
|
|||||||
import StackerNewsFeed from '@/components/feeds/StackerNewsFeed';
|
import StackerNewsFeed from '@/components/feeds/StackerNewsFeed';
|
||||||
import GlobalFeed from '@/components/feeds/GlobalFeed';
|
import GlobalFeed from '@/components/feeds/GlobalFeed';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { Message } from 'primereact/message';
|
import MessageInput from '@/components/feeds/MessageInput';
|
||||||
import { Tag } from 'primereact/tag';
|
|
||||||
import StackerNewsIcon from '../../public/images/sn.svg';
|
import StackerNewsIcon from '../../public/images/sn.svg';
|
||||||
import NostrIcon from '../../public/images/nostr.png';
|
import NostrIcon from '../../public/images/nostr.png';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
|
|
||||||
const Feed = () => {
|
const Feed = () => {
|
||||||
const [selectedTopic, setSelectedTopic] = useState('global');
|
const [selectedTopic, setSelectedTopic] = useState('global');
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [title, setTitle] = useState('Community');
|
const [title, setTitle] = useState('Community');
|
||||||
const allTopics = ['global', 'nostr', 'discord', 'stackernews'];
|
const allTopics = ['global', 'nostr', 'discord', 'stackernews'];
|
||||||
|
const [isMessageInputCollapsed, setIsMessageInputCollapsed] = useState(true);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@ -49,11 +50,15 @@ const Feed = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleMessageInput = (e) => {
|
||||||
|
setIsMessageInputCollapsed(e.value);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-gray-900 h-[100vh] w-[100vw] min-bottom-bar:w-[87vw]">
|
<div className="bg-gray-900 h-[100vh] w-[100vw] min-bottom-bar:w-[87vw]">
|
||||||
<div className="w-fit mx-4 pt-4 flex flex-col items-start">
|
<div className="w-[100vw] min-bottom-bar:w-[87vw] px-4 pt-4 flex flex-col items-start">
|
||||||
<div className='mb-4 flex flex-row items-end'>
|
<div className='mb-4 flex flex-row items-end'>
|
||||||
<h2 className="font-bold ml-1 mb-0">Community</h2>
|
<h2 className="font-bold mb-0">Community</h2>
|
||||||
<Button
|
<Button
|
||||||
icon={getTagIcon(title)}
|
icon={getTagIcon(title)}
|
||||||
className='ml-2 text-sm p-2 py-1 flex items-center cursor-default hover:bg-transparent'
|
className='ml-2 text-sm p-2 py-1 flex items-center cursor-default hover:bg-transparent'
|
||||||
@ -67,13 +72,20 @@ const Feed = () => {
|
|||||||
label={`${title}`}
|
label={`${title}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className='w-full flex flex-row items-center justify-between mb-2'>
|
||||||
<InputText
|
<InputText
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
icon="pi pi-search"
|
icon="pi pi-search"
|
||||||
className="w-full mb-2"
|
className="w-fit"
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
icon={isMessageInputCollapsed ? "pi pi-plus" : "pi pi-minus"}
|
||||||
|
onClick={() => setIsMessageInputCollapsed(!isMessageInputCollapsed)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<MessageInput collapsed={isMessageInputCollapsed} onToggle={toggleMessageInput} />
|
||||||
</div>
|
</div>
|
||||||
<div className="min-bottom-bar:hidden">
|
<div className="min-bottom-bar:hidden">
|
||||||
<CommunityMenuTab
|
<CommunityMenuTab
|
||||||
|
@ -14,3 +14,19 @@
|
|||||||
background: var(--green-500);
|
background: var(--green-500);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* panel */
|
||||||
|
.p-panel .p-panel-header {
|
||||||
|
border: none;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-panel .p-panel-content {
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-panel .p-panel-header .p-panel-icons {
|
||||||
|
display: none;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user