Changed Layout a bit

now we use less state for the layout. Chat and header are now sticky.
Moved some css vars.
This commit is contained in:
t1enne 2022-05-17 08:41:39 +02:00
parent 528ae4c1ad
commit a69ec7511a
6 changed files with 16 additions and 20 deletions

View file

@ -1,26 +1,20 @@
.root { .root {
display: grid; display: grid;
grid-template-columns: 1fr; grid-template-columns: 1fr auto;
} }
.mobileChat { .mobileChat {
display: block; display: block;
position: absolute;
background-color: white;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: calc(50vh - var(--header-h));
} }
.leftCol { .leftCol {
display: grid; display: grid;
// -64px, which is the header
grid-template-rows: 50vh calc(50vh - var(--header-h));
} }
.lowerRow { .lowerRow {
position: relative; position: relative;
display: grid; display: grid;
grid-template-rows: 1fr var(--header-h);
} }
.pageContentSection { .pageContentSection {
@ -35,7 +29,4 @@
.mobileChat { .mobileChat {
display: none; display: none;
} }
.root[data-columns='2'] {
grid-template-columns: 1fr var(--chat-w);
}
} }

View file

@ -45,7 +45,7 @@ export default function ContentComponent() {
const total = 0; const total = 0;
const isShowingChatColumn = const chatVisible =
chatState === ChatState.Available && chatVisibility === ChatVisibilityState.Visible; chatState === ChatState.Available && chatVisibility === ChatVisibilityState.Visible;
// This is example content. It should be removed. // This is example content. It should be removed.
@ -65,7 +65,7 @@ export default function ContentComponent() {
)); ));
return ( return (
<Content className={`${s.root}`} data-columns={isShowingChatColumn ? 2 : 1}> <Content className={`${s.root}`}>
<div className={`${s.leftCol}`}> <div className={`${s.leftCol}`}>
<OwncastPlayer source="/hls/stream.m3u8" online={online} /> <OwncastPlayer source="/hls/stream.m3u8" online={online} />
<Statusbar <Statusbar
@ -105,7 +105,7 @@ export default function ContentComponent() {
<Footer version={version} /> <Footer version={version} />
</div> </div>
</div> </div>
{isShowingChatColumn && <Sidebar />} {chatVisible && <Sidebar />}
</Content> </Content>
); );
} }

View file

@ -1,9 +1,12 @@
.header { .header {
position: sticky;
top: 0px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
z-index: 1; z-index: 1;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
background-color: var(--default-bg-color);
.logo { .logo {
display: flex; display: flex;
align-items: center; align-items: center;

View file

@ -5,6 +5,10 @@
@media (min-width: 768px) { @media (min-width: 768px) {
.root { .root {
position: sticky;
top: var(--header-h);
display: flex; display: flex;
min-width: 300px !important;
max-height: calc(100vh - var(--header-h));
} }
} }

View file

@ -1,12 +1,5 @@
// @import "~antd/dist/antd.dark"; // @import "~antd/dist/antd.dark";
:root {
// chat variables
// --header-h: 64px;
--chat-w: 300px;
--chat-input-h: 40.5px;
}
html, html,
body { body {
padding: 0; padding: 0;

View file

@ -78,4 +78,9 @@
--default-link-color: #6941c6; --default-link-color: #6941c6;
--default-bg-color: #1b1a26; --default-bg-color: #1b1a26;
--default-text-color: #f2f4f7; --default-text-color: #f2f4f7;
/* Layout variables */
--header-h: 64px;
--chat-w: 300px;
--chat-input-h: 40.5px;
} }