fix: tight border on mobile style

This commit is contained in:
Yifei Zhang 2023-03-30 16:20:47 +00:00
parent bf50ebac94
commit 1b140a1ed3
5 changed files with 32 additions and 21 deletions

View File

@ -26,13 +26,13 @@
@media only screen and (min-width: 600px) { @media only screen and (min-width: 600px) {
.tight-container { .tight-container {
--window-width: 100vw; --window-width: 100vw;
--window-height: 100vh; --window-height: var(--full-height);
--window-content-width: calc(100% - var(--sidebar-width)); --window-content-width: calc(100% - var(--sidebar-width));
@include container(); @include container();
max-width: 100vw; max-width: 100vw;
max-height: 100vh; max-height: var(--full-height);
border-radius: 0; border-radius: 0;
} }
@ -74,7 +74,7 @@
position: absolute; position: absolute;
left: -100%; left: -100%;
z-index: 999; z-index: 999;
height: 100vh; height: var(--full-height);
transition: all ease 0.3s; transition: all ease 0.3s;
box-shadow: none; box-shadow: none;
} }

View File

@ -23,7 +23,13 @@ import DownloadIcon from "../icons/download.svg";
import { Message, SubmitKey, useChatStore, ChatSession } from "../store"; import { Message, SubmitKey, useChatStore, ChatSession } from "../store";
import { showModal, showToast } from "./ui-lib"; import { showModal, showToast } from "./ui-lib";
import { copyToClipboard, downloadAs, isIOS, selectOrCopy } from "../utils"; import {
copyToClipboard,
downloadAs,
isIOS,
isMobileScreen,
selectOrCopy,
} from "../utils";
import Locale from "../locales"; import Locale from "../locales";
import dynamic from "next/dynamic"; import dynamic from "next/dynamic";
@ -614,7 +620,9 @@ export function Home() {
return ( return (
<div <div
className={`${ className={`${
config.tightBorder ? styles["tight-container"] : styles.container config.tightBorder && !isMobileScreen()
? styles["tight-container"]
: styles.container
}`} }`}
> >
<div <div

View File

@ -267,7 +267,6 @@ export function Settings(props: { closeSettings: () => void }) {
></input> ></input>
</SettingItem> </SettingItem>
<div className="no-mobile">
<SettingItem title={Locale.Settings.TightBorder}> <SettingItem title={Locale.Settings.TightBorder}>
<input <input
type="checkbox" type="checkbox"
@ -279,7 +278,6 @@ export function Settings(props: { closeSettings: () => void }) {
} }
></input> ></input>
</SettingItem> </SettingItem>
</div>
</List> </List>
<List> <List>
<SettingItem <SettingItem

View File

@ -53,12 +53,13 @@
--sidebar-width: 300px; --sidebar-width: 300px;
--window-content-width: calc(100% - var(--sidebar-width)); --window-content-width: calc(100% - var(--sidebar-width));
--message-max-width: 80%; --message-max-width: 80%;
--full-height: 100vh;
} }
@media only screen and (max-width: 600px) { @media only screen and (max-width: 600px) {
:root { :root {
--window-width: 100vw; --window-width: 100vw;
--window-height: 100vh; --window-height: var(--full-height);
--sidebar-width: 100vw; --sidebar-width: 100vw;
--window-content-width: var(--window-width); --window-content-width: var(--window-width);
--message-max-width: 100%; --message-max-width: 100%;
@ -80,7 +81,7 @@ body {
color: var(--black); color: var(--black);
margin: 0; margin: 0;
padding: 0; padding: 0;
height: 100vh; height: var(--full-height);
width: 100vw; width: 100vw;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -201,7 +202,7 @@ div.math {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
height: 100vh; height: var(--full-height);
width: 100vw; width: 100vw;
background-color: rgba($color: #000000, $alpha: 0.5); background-color: rgba($color: #000000, $alpha: 0.5);
display: flex; display: flex;

View File

@ -45,6 +45,10 @@ export function isIOS() {
return /iphone|ipad|ipod/.test(userAgent); return /iphone|ipad|ipod/.test(userAgent);
} }
export function isMobileScreen() {
return window.innerWidth <= 600;
}
export function selectOrCopy(el: HTMLElement, content: string) { export function selectOrCopy(el: HTMLElement, content: string) {
const currentSelection = window.getSelection(); const currentSelection = window.getSelection();