Skip to content

Commit

Permalink
style. 스타일 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyu-dev committed Dec 31, 2023
1 parent 1d4a444 commit eada175
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { PlanModalTemplate } from '@components/templates/PlanModalTemplate';
import { Alert } from '@utils/Alert';
import { convertError } from '@utils/errors';
import { AxiosError } from 'axios';
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components';

Expand All @@ -18,6 +18,16 @@ export const MyEncyclopediaTemplate = () => {
const dispatch = useDispatch();
const [isOpen, setIsOpen] = useState(false);

const listHeight = useMemo(() => {
const doc = document.querySelector('#root') as HTMLElement;
const scrollHeight = doc.scrollHeight;
const headerHeight = 95;
const footerHeight = 70;
const bodyHeight = 30;
const height = scrollHeight - (headerHeight + footerHeight + bodyHeight);
return { height: `${height}px` };
}, []);

const getEncyList = async () => {
try {
const res = await axiosFetch<any, TResponseCollection[]>({
Expand Down Expand Up @@ -52,7 +62,7 @@ export const MyEncyclopediaTemplate = () => {
return (
<Wrap>
<Spacing height={30} />
<StyledUl className="hidden-scroll">
<StyledUl className="hidden-scroll" style={listHeight}>
{collections?.map((collection, index) => (
<li key={index} onClick={handleClick(collection)}>
{collection.characterId === null ? (
Expand All @@ -75,16 +85,13 @@ export const MyEncyclopediaTemplate = () => {
};

const Wrap = styled.div`
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
padding: 0 13px;
`;

const StyledUl = styled.ul`
width: 100%;
flex: 1;
height: 100%;
display: flex;
justify-content: center;
Expand Down
11 changes: 7 additions & 4 deletions src/styles/global-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export const GlobalStyle = createGlobalStyle`
background: #f5f5f5;
overflow: hidden;
}
:root {
--vh: 100%;
}
#root {
position: relative;
Expand All @@ -32,6 +28,13 @@ export const GlobalStyle = createGlobalStyle`
}
}
body.swal2-height-auto {
height: 100vh !important;
height: var(--vh) !important;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
*::-webkit-scrollbar {
width: 5px;
height: 5px;
Expand Down
4 changes: 4 additions & 0 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,7 @@ div#root {
width: 100%;
height: 100%;
}

:root {
--vh: 100%;
}

0 comments on commit eada175

Please sign in to comment.