|
1 | 1 | import React, { useState } from 'react'; |
2 | 2 | import { RouteComponentProps } from '@reach/router'; |
3 | 3 | import { |
4 | | - Main, |
5 | | - PageContent, |
6 | | - Navigation, |
| 4 | + Layout, |
7 | 5 | Pagination, |
8 | 6 | SearchInput, |
9 | 7 | } from '@codesandbox/common/lib/components'; |
@@ -41,71 +39,68 @@ export const Profile: React.FC<RouteComponentProps> = () => { |
41 | 39 | // - Add drag and drop support for grids |
42 | 40 |
|
43 | 41 | return ( |
44 | | - <Main> |
45 | | - <Navigation /> |
46 | | - <PageContent> |
47 | | - <Content> |
48 | | - <UserInfo |
49 | | - canEdit |
50 | | - isEditing={isEditing} |
51 | | - toggleEditing={() => setIsEditing(!isEditing)} |
52 | | - onEdit={({ bio, socialLinks }) => { |
53 | | - setData({ |
54 | | - ...data, |
55 | | - user: { |
56 | | - ...data.user, |
57 | | - bio, |
58 | | - socialLinks, |
59 | | - }, |
60 | | - }); |
61 | | - }} |
62 | | - {...data.user} |
63 | | - /> |
64 | | - {data.user.featured && <FeaturedSandbox {...data.user.featured} />} |
65 | | - <SearchRow> |
66 | | - <SearchInput /> |
67 | | - <SandboxCount> |
68 | | - <em>{data.user.totalSandboxes}</em> |
69 | | - Sandboxes |
70 | | - </SandboxCount> |
71 | | - </SearchRow> |
72 | | - {isEditing && !data.user.pinned.length ? ( |
73 | | - <PinnedPlaceholder> |
74 | | - Drag your Sandbox here to pin them to your profile |
75 | | - </PinnedPlaceholder> |
76 | | - ) : isEditing && data.user.pinned.length ? ( |
| 42 | + <Layout> |
| 43 | + <Content> |
| 44 | + <UserInfo |
| 45 | + canEdit |
| 46 | + isEditing={isEditing} |
| 47 | + toggleEditing={() => setIsEditing(!isEditing)} |
| 48 | + onEdit={({ bio, socialLinks }) => { |
| 49 | + setData({ |
| 50 | + ...data, |
| 51 | + user: { |
| 52 | + ...data.user, |
| 53 | + bio, |
| 54 | + socialLinks, |
| 55 | + }, |
| 56 | + }); |
| 57 | + }} |
| 58 | + {...data.user} |
| 59 | + /> |
| 60 | + {data.user.featured && <FeaturedSandbox {...data.user.featured} />} |
| 61 | + <SearchRow> |
| 62 | + <SearchInput /> |
| 63 | + <SandboxCount> |
| 64 | + <em>{data.user.totalSandboxes}</em> |
| 65 | + Sandboxes |
| 66 | + </SandboxCount> |
| 67 | + </SearchRow> |
| 68 | + {isEditing && !data.user.pinned.length ? ( |
| 69 | + <PinnedPlaceholder> |
| 70 | + Drag your Sandbox here to pin them to your profile |
| 71 | + </PinnedPlaceholder> |
| 72 | + ) : isEditing && data.user.pinned.length ? ( |
| 73 | + <PinnedGrid> |
| 74 | + {data.user.pinned.map(sandbox => ( |
| 75 | + <ShowcaseCard key={sandbox.id} {...sandbox} /> |
| 76 | + ))} |
| 77 | + <DropPlaceholder>Drag Sandbox to pin</DropPlaceholder> |
| 78 | + </PinnedGrid> |
| 79 | + ) : ( |
| 80 | + data.user.pinned && ( |
77 | 81 | <PinnedGrid> |
78 | 82 | {data.user.pinned.map(sandbox => ( |
79 | 83 | <ShowcaseCard key={sandbox.id} {...sandbox} /> |
80 | 84 | ))} |
81 | | - <DropPlaceholder>Drag Sandbox to pin</DropPlaceholder> |
82 | 85 | </PinnedGrid> |
83 | | - ) : ( |
84 | | - data.user.pinned && ( |
85 | | - <PinnedGrid> |
86 | | - {data.user.pinned.map(sandbox => ( |
87 | | - <ShowcaseCard key={sandbox.id} {...sandbox} /> |
88 | | - ))} |
89 | | - </PinnedGrid> |
90 | | - ) |
91 | | - )} |
92 | | - {data.user.sandboxes && ( |
93 | | - <> |
94 | | - <TitleRow> |
95 | | - <SectionTitle>All Sandboxes</SectionTitle> |
96 | | - </TitleRow> |
97 | | - <ShowcaseGrid> |
98 | | - {data.user.sandboxes.map(sandbox => ( |
99 | | - <ShowcaseCard key={sandbox.id} {...sandbox} /> |
100 | | - ))} |
101 | | - </ShowcaseGrid> |
102 | | - <PageNav> |
103 | | - <Pagination pages={10} /> |
104 | | - </PageNav> |
105 | | - </> |
106 | | - )} |
107 | | - </Content> |
108 | | - </PageContent> |
109 | | - </Main> |
| 86 | + ) |
| 87 | + )} |
| 88 | + {data.user.sandboxes && ( |
| 89 | + <> |
| 90 | + <TitleRow> |
| 91 | + <SectionTitle>All Sandboxes</SectionTitle> |
| 92 | + </TitleRow> |
| 93 | + <ShowcaseGrid> |
| 94 | + {data.user.sandboxes.map(sandbox => ( |
| 95 | + <ShowcaseCard key={sandbox.id} {...sandbox} /> |
| 96 | + ))} |
| 97 | + </ShowcaseGrid> |
| 98 | + <PageNav> |
| 99 | + <Pagination pages={10} /> |
| 100 | + </PageNav> |
| 101 | + </> |
| 102 | + )} |
| 103 | + </Content> |
| 104 | + </Layout> |
110 | 105 | ); |
111 | 106 | }; |
0 commit comments