styles.css 11 KB

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