Skip to content

Commit

Permalink
fix: problems when instance list is long
Browse files Browse the repository at this point in the history
  • Loading branch information
pmh-only committed Aug 22, 2023
1 parent af6129f commit edc36ef
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
7 changes: 4 additions & 3 deletions src/components/InstanceTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ const InstanceTable: FC<Props> = ({ instances, isLoading }) => {
}

return (
<>
<div className={style.content}>
<section className={style.instanceTable}>
<Table
stickyHeader
variant="full-page"
columnDisplay={[
{ id: '카테고리', visible: true },
Expand Down Expand Up @@ -196,7 +197,7 @@ const InstanceTable: FC<Props> = ({ instances, isLoading }) => {
</Button>
</div>
),
width: '550px'
width: '700px'
},
{
id: '상태',
Expand Down Expand Up @@ -284,7 +285,7 @@ const InstanceTable: FC<Props> = ({ instances, isLoading }) => {
instance={event}
instanceAction={dispatch}
uuid={uuid} />
</>
</div>
)
}

Expand Down
43 changes: 25 additions & 18 deletions src/components/InstanceTable/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
.instanceTable {
display: flex;
width: 100%;
height: 100%;
overflow: auto;
scroll-snap-type: both mandatory;
.content {
height: calc(100% - 45px);
overflow-x: hidden;

table {
width: 2850px !important;
scroll-snap-type: both mandatory !important;
font-size: 16px;
}

> div, > div > div {
height: 100%;
}

> div > div > div > div:nth-child(2) {
position: absolute !important;
.instanceTable {
display: flex;
width: 100%;
height: calc(100% - 20px);
overflow: hidden;
scroll-snap-type: both mandatory;
overflow: auto;

table {
width: 3000px !important;
scroll-snap-type: both mandatory !important;
font-size: 16px;
}

> div, > div > div {
height: 100%;
}

> div > div > div > div:nth-child(2) {
position: fixed !important;
bottom: 20px !important;
}
}
}
6 changes: 3 additions & 3 deletions src/components/Modal/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
justify-content: center;
align-items: center;

z-index: 50;
z-index: 900;

.background {
position: absolute;
width: 100%;
height: 100%;
background-color: #00000050;
backdrop-filter: blur(3px);
z-index: 55;
z-index: 950;
}

.content {
position: relative;
z-index: 60;
z-index: 1000;
background-color: white;
width: 100%;
max-width: 500px;
Expand Down
4 changes: 2 additions & 2 deletions src/components/TableControl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ const TableControl: FC<Props> = ({ max, prices, title }) => {
<>
<div className={style.tableControl}>
<h1>{title}</h1>
<p><b>{prices ?? '...'}</b>$/월</p>
<p><b>{prices?.toFixed(2) ?? '...'}</b>$/월</p>

<div className={style.pageBtns}>
<button className={style.pageBtn} disabled={isPrevDisabled} onClick={onPrevClick}>
<img src="/assets/icon/prev.svg" alt="Previous" />
</button>

<b>{page + 1}</b>
<b>{page + 1}{max < 1 ? '' : `/${max}`}</b>

<button className={style.pageBtn} disabled={isNextDisabled} onClick={onNextClick}>
<img src="/assets/icon/next.svg" alt="Next" />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Instances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Instances: FC = () => {
const fetchData = async (): Promise<void> => {
setIsLoading(true)

const res = await axios(`/api/instances?take=10&skip=${parseInt(page) * 10}`, {
const res = await axios(`/api/instances?take=20&skip=${parseInt(page) * 10}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Search: FC = () => {
setIsLoading(true)
console.log(search)

const res = await axios(`/api/instances/search?take=10&skip=${parseInt(page) * 10}&query=${search ?? ''}`, {
const res = await axios(`/api/instances/search?take=20&skip=${parseInt(page) * 10}&query=${search ?? ''}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
Expand Down

0 comments on commit edc36ef

Please sign in to comment.