-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from ananjaemin/dev
Dev
- Loading branch information
Showing
18 changed files
with
329 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
import React from 'react'; | ||
import { toast } from 'react-toastify'; | ||
|
||
import * as S from './styled'; | ||
|
||
export const Navbar: React.FC = () => ( | ||
<S.NavbarContainer> | ||
<S.Nav to={'/'}>Upload</S.Nav> | ||
<S.Nav | ||
to={'/'} | ||
onClick={() => { | ||
toast.success('제작중!', { | ||
autoClose: 1000, | ||
position: toast.POSITION.BOTTOM_RIGHT, | ||
}); | ||
}} | ||
> | ||
API | ||
</S.Nav> | ||
<S.Nav to={'/api'}>API</S.Nav> | ||
<S.Nav to={'/filelist'}>File list</S.Nav> | ||
</S.NavbarContainer> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import styled from '@emotion/styled'; | ||
export const SkeletonUIBox = styled.div<{ randomWitdh: string }>` | ||
display: flex; | ||
background-color: var(--color-backgorund-filelistbox); | ||
border-radius: 10px; | ||
margin-bottom: 1.5rem; | ||
min-height: 4.6rem; | ||
min-width: ${(props) => props.randomWitdh}rem; | ||
overflow: hidden; | ||
&::before { | ||
content: ' '; | ||
width: 100%; | ||
height: auto; | ||
animation: loading 2s infinite; | ||
box-shadow: 0 0 30px 30px rgba(255, 255, 255, 0.3); | ||
} | ||
@keyframes loading { | ||
0% { | ||
transform: translateX(-50%); | ||
} | ||
50% { | ||
transform: translateX(100%); | ||
} | ||
100% { | ||
transform: translate(200%); | ||
} | ||
} | ||
`; | ||
export const SkeletonUIApiBox = styled(SkeletonUIBox)` | ||
min-height: 6.2rem; | ||
margin: 1rem; | ||
`; | ||
|
||
export const SkeletonUI = styled.div<{ | ||
width: string; | ||
height: string; | ||
margin: string; | ||
}>` | ||
display: flex; | ||
min-width: ${(props) => props.width}; | ||
min-height: ${(props) => props.height}; | ||
margin: ${(props) => props.margin}; | ||
background: var(--color-backgorund-filelistbox); | ||
border-radius: 10px; | ||
overflow: hidden; | ||
&::before { | ||
content: ' '; | ||
width: 100%; | ||
height: auto; | ||
animation: loading 2s infinite; | ||
box-shadow: 0 0 30px 30px rgba(255, 255, 255, 0.3); | ||
} | ||
@keyframes loading { | ||
0% { | ||
transform: translateX(-50%); | ||
} | ||
50% { | ||
transform: translateX(100%); | ||
} | ||
100% { | ||
transform: translate(200%); | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import axios from 'axios'; | ||
import React, { useState, useEffect } from 'react'; | ||
import { Route, Routes, Link } from 'react-router-dom'; | ||
|
||
import { SkeletonUIApiBox } from '../../components'; | ||
import { ApiPostPage } from '../postApi'; | ||
import * as S from './styled'; | ||
|
||
export const ApiPage: React.FC = () => { | ||
const [loading, setLoading] = useState(false); | ||
const [apiInfo, setApiInfo] = useState<any[]>(); | ||
const SkeletonUIRandomWidth = ['40', '50', '55', '45']; | ||
const getApiInfo = async () => { | ||
await axios({ | ||
method: 'get', | ||
url: 'https://tfb.minpeter.cf/info', | ||
}) | ||
.then((res) => { | ||
setApiInfo(res.data); | ||
setTimeout(() => { | ||
setLoading(true); //loading 확인하고싶으면 false로 바꿔주세요. | ||
}, 1200); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
getApiInfo(); | ||
}, []); | ||
|
||
return ( | ||
<S.ApiPageContainer> | ||
<Routes> | ||
<Route | ||
path="/" | ||
element={ | ||
<> | ||
<S.ApiListSection> | ||
{loading ? ( | ||
<> | ||
{apiInfo?.map((item, index) => ( | ||
<Link key={index} to={item.apiHandler} style={{ textDecoration: 'none' }}> | ||
<S.ApiListBox>{item.apiUrl}</S.ApiListBox> | ||
</Link> | ||
))} | ||
</> | ||
) : ( | ||
<> | ||
<SkeletonUIApiBox | ||
randomWitdh={SkeletonUIRandomWidth[Math.floor(Math.random() * 4)]} | ||
/> | ||
<SkeletonUIApiBox | ||
randomWitdh={SkeletonUIRandomWidth[Math.floor(Math.random() * 4)]} | ||
/> | ||
<SkeletonUIApiBox | ||
randomWitdh={SkeletonUIRandomWidth[Math.floor(Math.random() * 4)]} | ||
/> | ||
<SkeletonUIApiBox | ||
randomWitdh={SkeletonUIRandomWidth[Math.floor(Math.random() * 4)]} | ||
/> | ||
</> | ||
)} | ||
</S.ApiListSection> | ||
<S.ApiListSectionShadow /> | ||
</> | ||
} | ||
/> | ||
<Route path=":urlApi" element={<ApiPostPage />} /> | ||
</Routes> | ||
</S.ApiPageContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const ApiPageContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
`; | ||
|
||
export const ApiListSection = styled.div` | ||
overflow-y: auto; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
max-height: 40rem; | ||
&::-webkit-scrollbar { | ||
display: none; | ||
} | ||
`; | ||
|
||
export const ApiListBox = styled.div` | ||
background-color: var(--color-backgorund-filelistbox); | ||
color: var(--color-text-tertiary); | ||
border-radius: 10px; | ||
padding: 2rem 1.4rem 2rem 1.4rem; | ||
margin: 1rem; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
font-size: 2.2rem; | ||
font-weight: 700; | ||
cursor: pointer; | ||
`; | ||
|
||
export const ApiListSectionShadow = styled.div` | ||
width: 100%; | ||
height: 6rem; | ||
position: relative; | ||
top: -25px; | ||
background: linear-gradient(180deg, rgba(40, 42, 58, 0) 0%, #282a3a 45.31%); | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.