|
1 | | -import React from 'react'; |
2 | | -import styled from 'styled-components'; |
3 | | -import { sortBy } from 'lodash-es'; |
4 | | - |
5 | | -import RecordIcon from 'react-icons/lib/md/fiber-manual-record'; |
6 | | -import Input from '@codesandbox/common/lib/components/Input'; |
7 | 1 | import Margin from '@codesandbox/common/lib/components/spacing/Margin'; |
8 | | -import delay from '@codesandbox/common/lib/utils/animation/delay-effect'; |
9 | 2 | import Switch from '@codesandbox/common/lib/components/Switch'; |
10 | | - |
11 | 3 | import Tooltip from '@codesandbox/common/lib/components/Tooltip'; |
12 | | - |
13 | | -import AddIcon from 'react-icons/lib/md/add'; |
14 | | -import RemoveIcon from 'react-icons/lib/md/remove'; |
| 4 | +import { RoomInfo } from '@codesandbox/common/lib/types'; |
| 5 | +import { sortBy } from 'lodash-es'; |
| 6 | +import React from 'react'; |
15 | 7 | import FollowIcon from 'react-icons/lib/io/eye'; |
16 | 8 | import UnFollowIcon from 'react-icons/lib/io/eye-disabled'; |
| 9 | +import AddIcon from 'react-icons/lib/md/add'; |
| 10 | +import RecordIcon from 'react-icons/lib/md/fiber-manual-record'; |
| 11 | +import RemoveIcon from 'react-icons/lib/md/remove'; |
17 | 12 |
|
18 | | -import User from './User'; |
| 13 | +import { Description, WorkspaceInputContainer } from '../../elements'; |
19 | 14 | import Countdown from './Countdown'; |
| 15 | +import { |
| 16 | + Container, |
| 17 | + IconContainer, |
| 18 | + Mode, |
| 19 | + ModeDetails, |
| 20 | + ModeSelect, |
| 21 | + ModeSelector, |
| 22 | + Preference, |
| 23 | + PreferencesContainer, |
| 24 | + StyledInput, |
| 25 | + SubTitle, |
| 26 | + Title, |
| 27 | + Users, |
| 28 | +} from './elements'; |
20 | 29 | import LiveButton from './LiveButton'; |
21 | | - |
22 | | -import { Description, WorkspaceInputContainer } from '../../elements'; |
23 | | - |
24 | | -const Container = styled.div` |
25 | | - ${delay()}; |
26 | | - color: ${props => |
27 | | - props.theme.light ? 'rgba(0, 0, 0, 0.7)' : 'rgba(255, 255, 255, 0.7)'}; |
28 | | - box-sizing: border-box; |
29 | | -`; |
30 | | - |
31 | | -const Title = styled.div` |
32 | | - color: #fd2439fa; |
33 | | - font-weight: 800; |
34 | | - display: flex; |
35 | | - align-items: center; |
36 | | - vertical-align: middle; |
37 | | -
|
38 | | - padding: 0.5rem 1rem; |
39 | | - padding-top: 0; |
40 | | -
|
41 | | - svg { |
42 | | - margin-right: 0.25rem; |
43 | | - } |
44 | | -`; |
45 | | - |
46 | | -const StyledInput = styled(Input)` |
47 | | - width: calc(100% - 1.5rem); |
48 | | - margin: 0 0.75rem; |
49 | | - font-size: 0.875rem; |
50 | | -`; |
51 | | - |
52 | | -const SubTitle = styled.div` |
53 | | - text-transform: uppercase; |
54 | | - font-weight: 700; |
55 | | - color: rgba(255, 255, 255, 0.5); |
56 | | -
|
57 | | - padding-left: 1rem; |
58 | | - font-size: 0.875rem; |
59 | | -`; |
60 | | - |
61 | | -const Users = styled.div` |
62 | | - padding: 0.25rem 1rem; |
63 | | - padding-top: 0; |
64 | | - color: ${props => |
65 | | - props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; |
66 | | -`; |
67 | | - |
68 | | -const ModeSelect = styled.div` |
69 | | - position: relative; |
70 | | - margin: 0.5rem 1rem; |
71 | | -`; |
72 | | - |
73 | | -interface IModeProps { |
74 | | - selected: boolean; |
75 | | -} |
76 | | -const Mode = styled.button` |
77 | | - display: block; |
78 | | - text-align: left; |
79 | | - transition: 0.3s ease opacity; |
80 | | - padding: 0.5rem 1rem; |
81 | | - color: white; |
82 | | - border-radius: 4px; |
83 | | - width: 100%; |
84 | | - font-size: 1rem; |
85 | | -
|
86 | | - font-weight: 600; |
87 | | - border: none; |
88 | | - outline: none; |
89 | | - background-color: transparent; |
90 | | - cursor: ${props => (props.onClick ? 'pointer' : 'inherit')}; |
91 | | - color: white; |
92 | | - opacity: ${(props: IModeProps) => (props.selected ? 1 : 0.6)}; |
93 | | - margin: 0.25rem 0; |
94 | | -
|
95 | | - z-index: 3; |
96 | | -
|
97 | | - ${props => |
98 | | - props.onClick && |
99 | | - ` |
100 | | - &:hover { |
101 | | - opacity: 1; |
102 | | - }`}; |
103 | | -`; |
104 | | - |
105 | | -const ModeDetails = styled.div` |
106 | | - font-size: 0.75rem; |
107 | | - color: ${props => |
108 | | - props.theme.light ? 'rgba(0, 0, 0, 0.7)' : 'rgba(255, 255, 255, 0.7)'}; |
109 | | - margin-top: 0.25rem; |
110 | | -`; |
111 | | - |
112 | | -interface IModeSelectorProps { |
113 | | - i: number; |
114 | | -} |
115 | | -const ModeSelector = styled.div` |
116 | | - transition: 0.3s ease transform; |
117 | | - position: absolute; |
118 | | - left: 0; |
119 | | - right: 0; |
120 | | - top: 0; |
121 | | - height: 48px; |
122 | | -
|
123 | | - border: 2px solid rgba(253, 36, 57, 0.6); |
124 | | - background-color: rgba(253, 36, 57, 0.6); |
125 | | - border-radius: 4px; |
126 | | - z-index: -1; |
127 | | -
|
128 | | - transform: translateY(${(props: IModeSelectorProps) => props.i * 55}px); |
129 | | -`; |
130 | | - |
131 | | -const PreferencesContainer = styled.div` |
132 | | - margin: 1rem; |
133 | | - display: flex; |
134 | | -`; |
135 | | - |
136 | | -const Preference = styled.div` |
137 | | - flex: 1; |
138 | | - font-weight: 400; |
139 | | - color: ${props => |
140 | | - props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; |
141 | | - align-items: center; |
142 | | - justify-content: center; |
143 | | - font-size: 0.875rem; |
144 | | -`; |
145 | | - |
146 | | -const IconContainer = styled.div` |
147 | | - transition: 0.3s ease color; |
148 | | - color: ${props => |
149 | | - props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; |
150 | | - cursor: pointer; |
151 | | -
|
152 | | - &:hover { |
153 | | - color: white; |
154 | | - } |
155 | | -`; |
156 | | - |
157 | | -interface IRoomInfo { |
158 | | - users: Array<any>; |
159 | | - editorIds: Array<any>; |
160 | | - startTime: number; |
161 | | - roomId: string; |
162 | | - mode: string; |
163 | | -} |
| 30 | +import { User } from './User'; |
164 | 31 |
|
165 | 32 | interface ILiveInfoProps { |
166 | | - roomInfo: IRoomInfo; |
| 33 | + roomInfo: RoomInfo; |
167 | 34 | isOwner: boolean; |
168 | 35 | isTeam: boolean; |
169 | 36 | ownerIds: Array<any>; |
|
0 commit comments