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

Adjusted the sidebar width to cover the entire width for small screens #630

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ export const MessageAggregator = ({

const noMessages = messageList?.length === 0 || !messageRendered;
const ViewComponent = viewType === 'Popup' ? Popup : Sidebar;

return (
<ViewComponent
title={title}
iconName={iconName}
searchProps={searchProps}
onClose={() => setExclusiveState(null)}
style={{ padding: 0 }}
style={{
backgroundColor: theme.colors.background,
position: 'absolute',
right: 0,
zIndex: 1001,
}}
{...(viewType === 'Popup'
? {
isPopupHeader: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const getMessageAggregatorStyles = () => {
flex-direction: column;
justify-content: initial;
align-items: initial;
max-width: 100%;
width: 300px;
@media (max-width: 780px) {
width: 100vw;
}
`,

noMessageStyles: css`
Expand Down
11 changes: 11 additions & 0 deletions packages/react/src/views/RoomInformation/RoomInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Sidebar,
Popup,
useComponentOverrides,
useTheme,
} from '@embeddedchat/ui-elements';
import RCContext from '../../context/RCInstance';
import { useChannelStore } from '../../store';
Expand All @@ -23,13 +24,20 @@ const Roominfo = () => {
return `${host}/avatar/${channelname}`;
};

const { theme } = useTheme();
const ViewComponent = viewType === 'Popup' ? Popup : Sidebar;

return (
<ViewComponent
title="Room Information"
iconName="info"
onClose={() => setExclusiveState(null)}
style={{
backgroundColor: theme.colors.background,
position: 'absolute',
right: 0,
zIndex: 1001,
}}
{...(viewType === 'Popup'
? {
isPopupHeader: true,
Expand All @@ -41,6 +49,9 @@ const Roominfo = () => {
padding: 0 1rem 1rem;
margin: 0 auto;
overflow: auto;
@media (max-width: 780px) {
width: 100vw;
}
`}
>
<Avatar size="100%" url={getChannelAvatarURL(channelInfo.name)} />
Expand Down
10 changes: 7 additions & 3 deletions packages/react/src/views/RoomMembers/RoomMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ const RoomMembers = ({ members }) => {
const { host } = ECOptions;
const { theme } = useTheme();
const styles = getRoomMemberStyles(theme);

const toggleInviteView = useInviteStore((state) => state.toggleInviteView);
const showInvite = useInviteStore((state) => state.showInvite);
const [isLoading, setIsLoading] = useState(true);
const { variantOverrides } = useComponentOverrides('RoomMember');
const viewType = variantOverrides.viewType || 'Sidebar';

const [userInfo, setUserInfo] = useState(null);
const setExclusiveState = useSetExclusiveState();

useEffect(() => {
const getUserInfo = async () => {
try {
Expand All @@ -50,11 +47,18 @@ const RoomMembers = ({ members }) => {
const roles = userInfo && userInfo.roles ? userInfo.roles : [];
const isAdmin = roles.includes('admin');
const ViewComponent = viewType === 'Popup' ? Popup : Sidebar;

return (
<ViewComponent
title="Members"
iconName="members"
onClose={() => setExclusiveState(null)}
style={{
backgroundColor: theme.colors.background,
position: 'absolute',
right: 0,
zIndex: 1001,
}}
{...(viewType === 'Popup'
? {
isPopupHeader: true,
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/views/RoomMembers/RoomMembers.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ export const getRoomMemberStyles = () => {
display: flex;
flex-direction: column;
overflow: auto;
width: 100%;
justify-content: center;
padding: 0 1rem 1rem;
padding: 0 2rem 1rem;
width: 300px;
@media (max-width: 780px) {
width: 100vw;
}
`,
};

Expand Down
Loading