Showing
5 changed files
with
101 additions
and
16 deletions
app/src/assets/style/Main.scss
0 → 100644
1 | +.main { | ||
2 | + width: 100%; | ||
3 | + height: 100%; | ||
4 | + display: flex; | ||
5 | + justify-content: flex-start; | ||
6 | + align-items: center; | ||
7 | + flex-direction: column; | ||
8 | + | ||
9 | + .profile { | ||
10 | + width: 180px; | ||
11 | + height: 180px; | ||
12 | + display: flex; | ||
13 | + justify-content: center; | ||
14 | + align-items: center; | ||
15 | + flex-direction: column; | ||
16 | + overflow: hidden; | ||
17 | + | ||
18 | + img { | ||
19 | + width: 180px; | ||
20 | + height: 180px; | ||
21 | + border-radius: 50%; | ||
22 | + } | ||
23 | + } | ||
24 | + | ||
25 | + .list { | ||
26 | + flex: 1; | ||
27 | + width: 100%; | ||
28 | + max-height: calc(100vh - 255px); | ||
29 | + overflow-y: auto; | ||
30 | + display: flex; | ||
31 | + align-items: flex-start; | ||
32 | + justify-content: center; | ||
33 | + | ||
34 | + .followers { | ||
35 | + flex: 1; | ||
36 | + padding: .4rem; | ||
37 | + } | ||
38 | + .following { | ||
39 | + flex: 1; | ||
40 | + padding: .4rem; | ||
41 | + } | ||
42 | + | ||
43 | + .item { | ||
44 | + padding-left: 0.3rem; | ||
45 | + margin: .25rem 0; | ||
46 | + border-radius: 0.16rem; | ||
47 | + height: 1.8rem; | ||
48 | + display: flex; | ||
49 | + justify-content: center; | ||
50 | + align-items: center; | ||
51 | + | ||
52 | + &.item-0 { | ||
53 | + background-color: #efefef; | ||
54 | + } | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | + .title { | ||
59 | + font-size: 1rem; | ||
60 | + font-weight: 800; | ||
61 | + margin: 0.5rem 0; | ||
62 | + } | ||
63 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/src/components/format.number.ts
0 → 100644
1 | +export const formatNumber = (number : number) : string => { | ||
2 | + if(`${number}`.length > 6) { | ||
3 | + return `${Math.floor(number / 1000000)}m` | ||
4 | + } | ||
5 | + else if(`${number}`.length > 3) { | ||
6 | + return `${Math.floor(number / 1000)}k` | ||
7 | + } else { | ||
8 | + return `${number}`; | ||
9 | + } | ||
10 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -6,34 +6,44 @@ | ... | @@ -6,34 +6,44 @@ |
6 | * 다른 메뉴 보기 | 6 | * 다른 메뉴 보기 |
7 | **/ | 7 | **/ |
8 | import {getState} from "@src/store/state"; | 8 | import {getState} from "@src/store/state"; |
9 | +import {formatNumber} from "@src/components/format.number"; | ||
10 | +import '@src/assets/style/Main.scss' | ||
9 | 11 | ||
10 | const Main = () => { | 12 | const Main = () => { |
11 | const state = getState(); | 13 | const state = getState(); |
12 | let followers : string = ''; | 14 | let followers : string = ''; |
13 | let following : string = ''; | 15 | let following : string = ''; |
14 | - state.followers?.forEach(id => { | 16 | + // @ts-ignore |
15 | - followers += `<div>${id}</div>` | 17 | + state.followers?.sort() |
16 | - }); | 18 | + .forEach((id, idx) => { |
17 | - state.following?.forEach(id => { | 19 | + followers += `<div class="item item-${idx % 2}">${id}</div>` |
18 | - following += `<div>${id}</div>` | 20 | + }); |
19 | - }); | 21 | + // @ts-ignore |
22 | + state.following?.sort() | ||
23 | + .forEach((id, idx) => { | ||
24 | + following += `<div class="item item-${idx % 2}">${id}</div>` | ||
25 | + }); | ||
26 | + | ||
27 | + const followers_num = formatNumber(state.followers?.length || 0); | ||
28 | + const followings_num = formatNumber(state.following?.length || 0); | ||
20 | 29 | ||
21 | return ` | 30 | return ` |
22 | <div class="main"> | 31 | <div class="main"> |
23 | - <div id="profile"> | 32 | + <div class="profile"> |
24 | <img src="${state.src}" alt="${state.insta_id}-image"/> | 33 | <img src="${state.src}" alt="${state.insta_id}-image"/> |
25 | - <span class="profile-id">${state.insta_id}</span> | ||
26 | </div> | 34 | </div> |
27 | - <div id="list"> | 35 | + <div class="list"> |
28 | - <div id="followers"> | 36 | + <div class="followers"> |
29 | - ${followers} | 37 | + <h2 class="title">FOLLOWERS (${followers_num})</h2> |
30 | - </div> | 38 | + <div>${followers}</div> |
31 | - <div id="following"> | ||
32 | - ${following} | ||
33 | </div> | 39 | </div> |
40 | + <div class="following"> | ||
41 | + <h2 class="title">FOLLOWINGS (${followings_num})</h2> | ||
42 | + <div>${following}</div> | ||
43 | + </div> | ||
34 | </div> | 44 | </div> |
35 | </div> | 45 | </div> |
36 | ` | 46 | ` |
37 | } | 47 | } |
38 | 48 | ||
39 | -export default Main | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
49 | +export default Main; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -6,10 +6,11 @@ | ... | @@ -6,10 +6,11 @@ |
6 | 6 | ||
7 | import Title from "@src/components/title"; | 7 | import Title from "@src/components/title"; |
8 | import '@src/assets/style/Header.scss' | 8 | import '@src/assets/style/Header.scss' |
9 | +import {getState} from "@src/store/state"; | ||
9 | 10 | ||
10 | const Header = () : string => ` | 11 | const Header = () : string => ` |
11 | <div class="header"> | 12 | <div class="header"> |
12 | - ${Title('im title').Large} | 13 | + ${Title(getState().insta_id || 'INSTAGRAM').Large} |
13 | </div> | 14 | </div> |
14 | `; | 15 | `; |
15 | 16 | ... | ... |
-
Please register or login to post a comment