styles.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /* Constants */
  2. :root {
  3. --icon-size: 24px;
  4. --primary-color: #4285f4;
  5. --peer-width: 120px;
  6. color-scheme: light dark; /* both supported */
  7. }
  8. /* Layout */
  9. html {
  10. height: 100%;
  11. }
  12. html,
  13. body {
  14. margin: 0;
  15. display: flex;
  16. flex-direction: column;
  17. width: 100%;
  18. overflow-x: hidden;
  19. }
  20. body {
  21. flex-grow: 1;
  22. align-items: center;
  23. justify-content: center;
  24. overflow-y: hidden;
  25. }
  26. .row-reverse {
  27. display: flex;
  28. flex-direction: row-reverse;
  29. }
  30. .row {
  31. display: flex;
  32. flex-direction: row;
  33. }
  34. .column {
  35. display: flex;
  36. flex-direction: column;
  37. }
  38. .center {
  39. display: flex;
  40. align-items: center;
  41. justify-content: center;
  42. }
  43. .full {
  44. position: absolute;
  45. top: 0;
  46. left: 0;
  47. right: 0;
  48. bottom: 0;
  49. }
  50. header {
  51. position: absolute;
  52. top: 0;
  53. left: 0;
  54. right: 0;
  55. height: 56px;
  56. align-items: center;
  57. padding: 16px;
  58. box-sizing: border-box;
  59. }
  60. [hidden] {
  61. display: none !important;
  62. }
  63. /* Typography */
  64. body {
  65. font-family: -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  66. -webkit-font-smoothing: antialiased;
  67. -moz-osx-font-smoothing: grayscale;
  68. }
  69. h1 {
  70. font-size: 34px;
  71. font-weight: 400;
  72. letter-spacing: -.01em;
  73. line-height: 40px;
  74. margin: 8px 0 0;
  75. }
  76. h2 {
  77. font-size: 24px;
  78. font-weight: 400;
  79. letter-spacing: -.012em;
  80. line-height: 32px;
  81. }
  82. h3 {
  83. font-size: 20px;
  84. font-weight: 500;
  85. margin: 16px 0;
  86. }
  87. .font-subheading {
  88. font-size: 16px;
  89. font-weight: 400;
  90. line-height: 24px;
  91. }
  92. .font-body1,
  93. body {
  94. font-size: 14px;
  95. font-weight: 400;
  96. line-height: 20px;
  97. }
  98. .font-body2 {
  99. font-size: 12px;
  100. line-height: 18px;
  101. }
  102. a {
  103. text-decoration: none;
  104. color: currentColor;
  105. cursor: pointer;
  106. }
  107. /* Icons */
  108. .icon {
  109. width: var(--icon-size);
  110. height: var(--icon-size);
  111. fill: currentColor;
  112. }
  113. /* Shadows */
  114. [shadow="1"] {
  115. box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),
  116. 0 1px 8px 0 rgba(0, 0, 0, 0.12),
  117. 0 3px 3px -2px rgba(0, 0, 0, 0.4);
  118. }
  119. [shadow="2"] {
  120. box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14),
  121. 0 1px 10px 0 rgba(0, 0, 0, 0.12),
  122. 0 2px 4px -1px rgba(0, 0, 0, 0.4);
  123. }
  124. /* Animations */
  125. @keyframes fade-in {
  126. 0% {
  127. opacity: 0;
  128. }
  129. }
  130. /* Main Header */
  131. body>header a {
  132. margin-left: 8px;
  133. }
  134. /* Peers List */
  135. x-peers {
  136. width: 100%;
  137. overflow: hidden;
  138. flex-flow: row wrap;
  139. z-index: 2;
  140. }
  141. /* Empty Peers List */
  142. x-no-peers {
  143. padding: 8px;
  144. text-align: center;
  145. /* prevent flickering on load */
  146. animation: fade-in 300ms;
  147. animation-delay: 500ms;
  148. animation-fill-mode: backwards;
  149. }
  150. x-no-peers h2,
  151. x-no-peers a {
  152. color: var(--primary-color);
  153. }
  154. x-peers:not(:empty)+x-no-peers {
  155. display: none;
  156. }
  157. /* Peer */
  158. x-peer {
  159. -webkit-user-select: none;
  160. user-select: none;
  161. }
  162. x-peer label {
  163. width: var(--peer-width);
  164. padding: 8px;
  165. cursor: pointer;
  166. touch-action: manipulation;
  167. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  168. position: relative;
  169. }
  170. x-peer .name {
  171. width: var(--peer-width);
  172. white-space: nowrap;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. text-align: center;
  176. }
  177. input[type="file"] {
  178. visibility: hidden;
  179. position: absolute;
  180. }
  181. x-peer x-icon {
  182. --icon-size: 40px;
  183. width: var(--icon-size);
  184. padding: 12px;
  185. border-radius: 50%;
  186. background: var(--primary-color);
  187. color: white;
  188. display: flex;
  189. margin-bottom: 8px;
  190. transition: transform 150ms;
  191. will-change: transform;
  192. }
  193. x-peer:not([transfer]):hover x-icon,
  194. x-peer:not([transfer]):focus x-icon {
  195. transform: scale(1.05);
  196. }
  197. x-peer[transfer] x-icon {
  198. box-shadow: none;
  199. opacity: 0.8;
  200. transform: scale(1);
  201. }
  202. .status {
  203. height: 18px;
  204. opacity: 0.7;
  205. }
  206. x-peer[transfer] .status:before {
  207. content: 'Transfering...';
  208. }
  209. x-peer x-icon {
  210. animation: pop 600ms ease-out 1;
  211. }
  212. @keyframes pop {
  213. 0% {
  214. transform: scale(0.7);
  215. }
  216. 40% {
  217. transform: scale(1.2);
  218. }
  219. }
  220. x-peer[drop] x-icon {
  221. transform: scale(1.1);
  222. }
  223. /* Footer */
  224. footer {
  225. position: absolute;
  226. bottom: 0;
  227. left: 0;
  228. right: 0;
  229. align-items: center;
  230. padding: 0 0 16px 0;
  231. }
  232. footer .logo {
  233. --icon-size: 80px;
  234. margin-bottom: 8px;
  235. color: var(--primary-color);
  236. }
  237. footer .font-body2 {
  238. color: var(--primary-color);
  239. }
  240. @media (min-height: 800px) {
  241. footer {
  242. margin-bottom: 16px;
  243. }
  244. }
  245. /* Dialog */
  246. x-dialog x-background {
  247. background: rgba(0, 0, 0, 0.61);
  248. z-index: 10;
  249. transition: opacity 300ms;
  250. will-change: opacity;
  251. padding: 16px;
  252. }
  253. x-dialog x-paper {
  254. z-index: 3;
  255. background: white;
  256. border-radius: 8px;
  257. padding: 16px 24px;
  258. width: 100%;
  259. max-width: 400px;
  260. box-sizing: border-box;
  261. transition: transform 300ms;
  262. will-change: transform;
  263. }
  264. x-dialog:not([show]) {
  265. pointer-events: none;
  266. }
  267. x-dialog:not([show]) x-paper {
  268. transform: scale(0.1);
  269. }
  270. x-dialog:not([show]) x-background {
  271. opacity: 0;
  272. }
  273. x-dialog .row-reverse>.button {
  274. margin-top: 16px;
  275. margin-left: 8px;
  276. }
  277. x-dialog a{
  278. color: var(--primary-color);
  279. }
  280. /* Receive Dialog */
  281. #receiveTextDialog #text {
  282. width: 100%;
  283. word-break: break-all;
  284. max-height: 300px;
  285. overflow-x: hidden;
  286. overflow-y: auto;
  287. -webkit-user-select: all;
  288. -moz-user-select: all;
  289. user-select: all;
  290. }
  291. /* Button */
  292. .button {
  293. padding: 0 16px;
  294. box-sizing: border-box;
  295. min-height: 36px;
  296. min-width: 100px;
  297. font-size: 14px;
  298. line-height: 24px;
  299. font-weight: 700;
  300. letter-spacing: 0.12em;
  301. text-transform: uppercase;
  302. white-space: nowrap;
  303. cursor: pointer;
  304. user-select: none;
  305. background: inherit;
  306. color: var(--primary-color);
  307. }
  308. .button,
  309. .icon-button {
  310. position: relative;
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  315. touch-action: manipulation;
  316. border: none;
  317. outline: none;
  318. }
  319. .button:before,
  320. .icon-button:before {
  321. content: '';
  322. position: absolute;
  323. top: 0;
  324. left: 0;
  325. right: 0;
  326. bottom: 0;
  327. background: currentColor;
  328. opacity: 0;
  329. transition: opacity 300ms;
  330. }
  331. .button:hover:before,
  332. .icon-button:hover:before {
  333. opacity: 0.1;
  334. }
  335. .button:before {
  336. border-radius: 8px;
  337. }
  338. .button:focus:before,
  339. .icon-button:focus:before {
  340. opacity: 0.2;
  341. }
  342. button::-moz-focus-inner {
  343. border: 0;
  344. }
  345. /* Icon Button */
  346. .icon-button {
  347. width: 40px;
  348. height: 40px;
  349. }
  350. .icon-button:before {
  351. border-radius: 50%;
  352. }
  353. /* Text Input */
  354. input {
  355. width: 100%;
  356. box-sizing: border-box;
  357. border: none;
  358. outline: none;
  359. padding: 16px 24px;
  360. border-radius: 50px;
  361. margin: 8px 0;
  362. line-height: 16px;
  363. font-size: 14px;
  364. }
  365. /* Info Animation */
  366. #about {
  367. color: white;
  368. z-index: 11;
  369. overflow: hidden;
  370. pointer-events: none;
  371. text-align: center;
  372. }
  373. #about .fade-in {
  374. transition: opacity 300ms;
  375. will-change: opacity;
  376. transition-delay: 300ms;
  377. z-index: 11;
  378. pointer-events: all;
  379. }
  380. #about:not(:target) .fade-in {
  381. opacity: 0;
  382. pointer-events: none;
  383. transition-delay: 0;
  384. }
  385. #about .logo {
  386. --icon-size: 96px;
  387. }
  388. #about x-background {
  389. position: absolute;
  390. top: calc(32px - 200px);
  391. right: calc(32px - 200px);
  392. width: 400px;
  393. height: 400px;
  394. border-radius: 50%;
  395. background: var(--primary-color);
  396. transform: scale(0);
  397. z-index: -1;
  398. }
  399. /* Hack such that initial scale(0) isn't animated */
  400. #about x-background{
  401. will-change: transform;
  402. transition: transform 800ms cubic-bezier(0.77, 0, 0.175, 1);
  403. }
  404. #about:target x-background {
  405. transform: scale(10);
  406. }
  407. #about .row a {
  408. margin: 8px 8px -16px;
  409. }
  410. /* Loading Indicator */
  411. .progress {
  412. width: 80px;
  413. height: 80px;
  414. position: absolute;
  415. top: 0px;
  416. clip: rect(0px, 80px, 80px, 40px);
  417. --progress: rotate(0deg);
  418. transition: transform 200ms;
  419. }
  420. .circle {
  421. width: 72px;
  422. height: 72px;
  423. border: 4px solid var(--primary-color);
  424. border-radius: 40px;
  425. position: absolute;
  426. clip: rect(0px, 40px, 80px, 0px);
  427. will-change: transform;
  428. transform: var(--progress);
  429. }
  430. .over50 {
  431. clip: rect(auto, auto, auto, auto);
  432. }
  433. .over50 .circle.right {
  434. transform: rotate(180deg);
  435. }
  436. /* Toast */
  437. .toast-container {
  438. padding: 0 8px 24px;
  439. overflow: hidden;
  440. pointer-events: none;
  441. }
  442. x-toast {
  443. position: absolute;
  444. min-height: 48px;
  445. bottom: 24px;
  446. width: 100%;
  447. max-width: 344px;
  448. background-color: #323232;
  449. color: rgba(255, 255, 255, 0.95);
  450. align-items: center;
  451. box-sizing: border-box;
  452. padding: 8px 24px;
  453. z-index: 20;
  454. transition: opacity 200ms, transform 300ms ease-out;
  455. cursor: default;
  456. line-height: 24px;
  457. border-radius: 8px;
  458. pointer-events: all;
  459. }
  460. x-toast:not([show]):not(:hover) {
  461. opacity: 0;
  462. transform: translateY(100px);
  463. }
  464. /* Instructions */
  465. x-instructions {
  466. position: absolute;
  467. top: 120px;
  468. opacity: 0.5;
  469. transition: opacity 300ms;
  470. z-index: -1;
  471. }
  472. x-instructions:before {
  473. content: attr(mobile);
  474. }
  475. x-peers:empty~x-instructions {
  476. opacity: 0;
  477. }
  478. /* Responsive Styles */
  479. @media (min-height: 800px) {
  480. footer {
  481. margin-bottom: 16px;
  482. }
  483. }
  484. @media screen and (min-height: 800px),
  485. screen and (min-width: 1100px) {
  486. x-instructions:before {
  487. content: attr(desktop);
  488. }
  489. }
  490. @media (max-height: 420px) {
  491. x-instructions {
  492. top: 24px;
  493. }
  494. footer .logo {
  495. --icon-size: 40px;
  496. }
  497. }
  498. @supports (-webkit-overflow-scrolling: touch) {
  499. /* CSS specific to iOS devices */
  500. html {
  501. position: fixed;
  502. }
  503. x-instructions:before {
  504. content: attr(mobile);
  505. }
  506. }
  507. /* Default colors */
  508. body {
  509. --text-color: #333;
  510. color: #333;
  511. --bkg-color: #fafafa;
  512. background-color: #fafafa;
  513. }
  514. /* Dark theme colors */
  515. body.dark-theme {
  516. --text-color: #eee;
  517. color: #eee;
  518. --bkg-color: #121212;
  519. background-color: #121212;
  520. }
  521. /* Styles for users who prefer dark mode at the OS level */
  522. @media (prefers-color-scheme: dark) {
  523. /* defaults to dark theme */
  524. body {
  525. --text-color: #eee;
  526. color: #eee;
  527. --bkg-color: #121212;
  528. background-color: #121212;
  529. }
  530. x-dialog x-paper {
  531. --bkg-color: #333;
  532. background-color: #333;
  533. }
  534. input {
  535. --text-color: #eee;
  536. color: #eee;
  537. --bkg-color: #121212;
  538. background-color: #121212;
  539. }
  540. /* Override dark mode with light mode styles if the user decides to swap */
  541. body.light-theme {
  542. --text-color: #333;
  543. color: #333;
  544. --bkg-color: #fafafa;
  545. background-color: #fafafa;
  546. }
  547. body.light-theme x-dialog x-paper {
  548. --bkg-color: #fff;
  549. background-color: #fff;
  550. }
  551. body.light-theme input {
  552. --text-color: #333;
  553. color: #333;
  554. --bkg-color: #f1f3f4;
  555. background: #f1f3f4;
  556. }
  557. }