Skip to content

Commit

Permalink
Adjusted the sidebar width to cover the entire width for small screens (
Browse files Browse the repository at this point in the history
#630)

* Adjusted the sidebar width to cover the entire width for small screen size

* Transferred the styles to styles.js files

* Fixed Linting Issue

---------

Co-authored-by: Zishan Ahmad <[email protected]>
  • Loading branch information
abirc8010 and Spiral-Memory authored Sep 30, 2024
1 parent df7f1b4 commit 0aafed8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
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

0 comments on commit 0aafed8

Please sign in to comment.