styles.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  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. textarea {
  382. width: 100%;
  383. box-sizing: border-box;
  384. border: none;
  385. outline: none;
  386. padding: 16px 24px;
  387. border-radius: 16px;
  388. margin: 8px 0;
  389. line-height: 16px;
  390. font-size: 14px;
  391. font-family: inherit;
  392. resize: none;
  393. background: #f1f3f4;
  394. }
  395. /* Info Animation */
  396. #about {
  397. color: white;
  398. z-index: 11;
  399. overflow: hidden;
  400. pointer-events: none;
  401. text-align: center;
  402. }
  403. #about .fade-in {
  404. transition: opacity 300ms;
  405. will-change: opacity;
  406. transition-delay: 300ms;
  407. z-index: 11;
  408. pointer-events: all;
  409. }
  410. #about:not(:target) .fade-in {
  411. opacity: 0;
  412. pointer-events: none;
  413. transition-delay: 0;
  414. }
  415. #about .logo {
  416. --icon-size: 96px;
  417. }
  418. #about x-background {
  419. position: absolute;
  420. top: calc(32px - 200px);
  421. right: calc(32px - 200px);
  422. width: 400px;
  423. height: 400px;
  424. border-radius: 50%;
  425. background: var(--primary-color);
  426. transform: scale(0);
  427. z-index: -1;
  428. }
  429. /* Hack such that initial scale(0) isn't animated */
  430. #about x-background {
  431. will-change: transform;
  432. transition: transform 800ms cubic-bezier(0.77, 0, 0.175, 1);
  433. }
  434. #about:target x-background {
  435. transform: scale(10);
  436. }
  437. #about .row a {
  438. margin: 8px 8px -16px;
  439. }
  440. /* Loading Indicator */
  441. .progress {
  442. width: 80px;
  443. height: 80px;
  444. position: absolute;
  445. top: 0px;
  446. clip: rect(0px, 80px, 80px, 40px);
  447. --progress: rotate(0deg);
  448. transition: transform 200ms;
  449. }
  450. .circle {
  451. width: 72px;
  452. height: 72px;
  453. border: 4px solid var(--primary-color);
  454. border-radius: 40px;
  455. position: absolute;
  456. clip: rect(0px, 40px, 80px, 0px);
  457. will-change: transform;
  458. transform: var(--progress);
  459. }
  460. .over50 {
  461. clip: rect(auto, auto, auto, auto);
  462. }
  463. .over50 .circle.right {
  464. transform: rotate(180deg);
  465. }
  466. /* Generic placeholder */
  467. [placeholder]:empty:before {
  468. content: attr(placeholder);
  469. }
  470. /* Toast */
  471. .toast-container {
  472. padding: 0 8px 24px;
  473. overflow: hidden;
  474. pointer-events: none;
  475. }
  476. x-toast {
  477. position: absolute;
  478. min-height: 48px;
  479. bottom: 24px;
  480. width: 100%;
  481. max-width: 344px;
  482. background-color: #323232;
  483. color: rgba(255, 255, 255, 0.95);
  484. align-items: center;
  485. box-sizing: border-box;
  486. padding: 8px 24px;
  487. z-index: 20;
  488. transition: opacity 200ms, transform 300ms ease-out;
  489. cursor: default;
  490. line-height: 24px;
  491. border-radius: 8px;
  492. pointer-events: all;
  493. }
  494. x-toast:not([show]):not(:hover) {
  495. opacity: 0;
  496. transform: translateY(100px);
  497. }
  498. /* Instructions */
  499. x-instructions {
  500. position: absolute;
  501. top: 120px;
  502. opacity: 0.5;
  503. transition: opacity 300ms;
  504. z-index: -1;
  505. text-align: center;
  506. }
  507. x-instructions:before {
  508. content: attr(mobile);
  509. }
  510. x-peers:empty~x-instructions {
  511. opacity: 0;
  512. }
  513. /* Responsive Styles */
  514. @media (min-height: 800px) {
  515. footer {
  516. margin-bottom: 16px;
  517. }
  518. }
  519. @media screen and (min-height: 800px),
  520. screen and (min-width: 1100px) {
  521. x-instructions:before {
  522. content: attr(desktop);
  523. }
  524. }
  525. @media (max-height: 420px) {
  526. x-instructions {
  527. top: 24px;
  528. }
  529. footer .logo {
  530. --icon-size: 40px;
  531. }
  532. }
  533. @supports (-webkit-overflow-scrolling: touch) {
  534. /* CSS specific to iOS devices */
  535. html {
  536. position: fixed;
  537. }
  538. x-instructions:before {
  539. content: attr(mobile);
  540. }
  541. }
  542. /*
  543. Color Themes
  544. */
  545. /* Default colors */
  546. :root {
  547. --text-color: #333;
  548. --bg-color: #fff;
  549. --input-bg-color: #f1f3f4;
  550. }
  551. body {
  552. color: var(--text-color);
  553. background-color: var(--bg-color);
  554. }
  555. x-dialog x-paper {
  556. background-color: var(--bg-color);
  557. }
  558. textarea {
  559. color: var(--text-color);
  560. background-color: var(--input-bg-color);
  561. }
  562. /* Dark theme colors */
  563. body.dark-theme {
  564. --text-color: #eee;
  565. --bg-color: #121212;
  566. --input-bg-color: #333;
  567. }
  568. /* Styles for users who prefer dark mode at the OS level */
  569. @media (prefers-color-scheme: dark) {
  570. /* defaults to dark theme */
  571. body {
  572. --text-color: #eee;
  573. --bg-color: #121212;
  574. --input-bg-color: #333;
  575. }
  576. /* Override dark mode with light mode styles if the user decides to swap */
  577. body.light-theme {
  578. --text-color: #333;
  579. --bg-color: #fafafa;
  580. --input-bg-color: #f1f3f4;
  581. }
  582. }