styles.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  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: 'Transferring...';
  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. text-align: center;
  232. }
  233. footer .logo {
  234. --icon-size: 80px;
  235. margin-bottom: 8px;
  236. color: var(--primary-color);
  237. }
  238. footer .font-body2 {
  239. color: var(--primary-color);
  240. }
  241. @media (min-height: 800px) {
  242. footer {
  243. margin-bottom: 16px;
  244. }
  245. }
  246. /* Dialog */
  247. x-dialog x-background {
  248. background: rgba(0, 0, 0, 0.61);
  249. z-index: 10;
  250. transition: opacity 300ms;
  251. will-change: opacity;
  252. padding: 16px;
  253. }
  254. x-dialog x-paper {
  255. z-index: 3;
  256. background: white;
  257. border-radius: 8px;
  258. padding: 16px 24px;
  259. width: 100%;
  260. max-width: 400px;
  261. box-sizing: border-box;
  262. transition: transform 300ms;
  263. will-change: transform;
  264. }
  265. x-dialog:not([show]) {
  266. pointer-events: none;
  267. }
  268. x-dialog:not([show]) x-paper {
  269. transform: scale(0.1);
  270. }
  271. x-dialog:not([show]) x-background {
  272. opacity: 0;
  273. }
  274. x-dialog .row-reverse>.button {
  275. margin-top: 16px;
  276. margin-left: 8px;
  277. }
  278. x-dialog a{
  279. color: var(--primary-color);
  280. }
  281. /* Receive Dialog */
  282. #receiveTextDialog #text {
  283. width: 100%;
  284. word-break: break-all;
  285. max-height: 300px;
  286. overflow-x: hidden;
  287. overflow-y: auto;
  288. -webkit-user-select: all;
  289. -moz-user-select: all;
  290. user-select: all;
  291. white-space: pre;
  292. }
  293. #receiveTextDialog #text a {
  294. cursor: pointer;
  295. }
  296. #receiveTextDialog #text a:hover {
  297. text-decoration: underline;
  298. }
  299. #receiveTextDialog h3{
  300. /* Select the received text when double-clicking the dialog */
  301. user-select: none;
  302. pointer-events: none;
  303. }
  304. /* Button */
  305. .button {
  306. padding: 0 16px;
  307. box-sizing: border-box;
  308. min-height: 36px;
  309. min-width: 100px;
  310. font-size: 14px;
  311. line-height: 24px;
  312. font-weight: 700;
  313. letter-spacing: 0.12em;
  314. text-transform: uppercase;
  315. white-space: nowrap;
  316. cursor: pointer;
  317. user-select: none;
  318. background: inherit;
  319. color: var(--primary-color);
  320. }
  321. .button,
  322. .icon-button {
  323. position: relative;
  324. display: flex;
  325. align-items: center;
  326. justify-content: center;
  327. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  328. touch-action: manipulation;
  329. border: none;
  330. outline: none;
  331. }
  332. .button:before,
  333. .icon-button:before {
  334. content: '';
  335. position: absolute;
  336. top: 0;
  337. left: 0;
  338. right: 0;
  339. bottom: 0;
  340. background: currentColor;
  341. opacity: 0;
  342. transition: opacity 300ms;
  343. }
  344. .button:hover:before,
  345. .icon-button:hover:before {
  346. opacity: 0.1;
  347. }
  348. .button:before {
  349. border-radius: 8px;
  350. }
  351. .button:focus:before,
  352. .icon-button:focus:before {
  353. opacity: 0.2;
  354. }
  355. button::-moz-focus-inner {
  356. border: 0;
  357. }
  358. /* Icon Button */
  359. .icon-button {
  360. width: 40px;
  361. height: 40px;
  362. }
  363. .icon-button:before {
  364. border-radius: 50%;
  365. }
  366. /* Text Input */
  367. input,
  368. textarea {
  369. width: 100%;
  370. box-sizing: border-box;
  371. border: none;
  372. outline: none;
  373. padding: 16px 24px;
  374. border-radius: 16px;
  375. margin: 8px 0;
  376. line-height: 16px;
  377. font-size: 14px;
  378. font-family: inherit;
  379. resize: none;
  380. }
  381. /* Info Animation */
  382. #about {
  383. color: white;
  384. z-index: 11;
  385. overflow: hidden;
  386. pointer-events: none;
  387. text-align: center;
  388. }
  389. #about .fade-in {
  390. transition: opacity 300ms;
  391. will-change: opacity;
  392. transition-delay: 300ms;
  393. z-index: 11;
  394. pointer-events: all;
  395. }
  396. #about:not(:target) .fade-in {
  397. opacity: 0;
  398. pointer-events: none;
  399. transition-delay: 0;
  400. }
  401. #about .logo {
  402. --icon-size: 96px;
  403. }
  404. #about x-background {
  405. position: absolute;
  406. top: calc(32px - 200px);
  407. right: calc(32px - 200px);
  408. width: 400px;
  409. height: 400px;
  410. border-radius: 50%;
  411. background: var(--primary-color);
  412. transform: scale(0);
  413. z-index: -1;
  414. }
  415. /* Hack such that initial scale(0) isn't animated */
  416. #about x-background{
  417. will-change: transform;
  418. transition: transform 800ms cubic-bezier(0.77, 0, 0.175, 1);
  419. }
  420. #about:target x-background {
  421. transform: scale(10);
  422. }
  423. #about .row a {
  424. margin: 8px 8px -16px;
  425. }
  426. /* Loading Indicator */
  427. .progress {
  428. width: 80px;
  429. height: 80px;
  430. position: absolute;
  431. top: 0px;
  432. clip: rect(0px, 80px, 80px, 40px);
  433. --progress: rotate(0deg);
  434. transition: transform 200ms;
  435. }
  436. .circle {
  437. width: 72px;
  438. height: 72px;
  439. border: 4px solid var(--primary-color);
  440. border-radius: 40px;
  441. position: absolute;
  442. clip: rect(0px, 40px, 80px, 0px);
  443. will-change: transform;
  444. transform: var(--progress);
  445. }
  446. .over50 {
  447. clip: rect(auto, auto, auto, auto);
  448. }
  449. .over50 .circle.right {
  450. transform: rotate(180deg);
  451. }
  452. /* Generic placeholder */
  453. [placeholder]:empty:before {
  454. content: attr(placeholder);
  455. }
  456. /* Toast */
  457. .toast-container {
  458. padding: 0 8px 24px;
  459. overflow: hidden;
  460. pointer-events: none;
  461. }
  462. x-toast {
  463. position: absolute;
  464. min-height: 48px;
  465. bottom: 24px;
  466. width: 100%;
  467. max-width: 344px;
  468. background-color: #323232;
  469. color: rgba(255, 255, 255, 0.95);
  470. align-items: center;
  471. box-sizing: border-box;
  472. padding: 8px 24px;
  473. z-index: 20;
  474. transition: opacity 200ms, transform 300ms ease-out;
  475. cursor: default;
  476. line-height: 24px;
  477. border-radius: 8px;
  478. pointer-events: all;
  479. }
  480. x-toast:not([show]):not(:hover) {
  481. opacity: 0;
  482. transform: translateY(100px);
  483. }
  484. /* Instructions */
  485. x-instructions {
  486. position: absolute;
  487. top: 120px;
  488. opacity: 0.5;
  489. transition: opacity 300ms;
  490. z-index: -1;
  491. text-align: center;
  492. }
  493. x-instructions:before {
  494. content: attr(mobile);
  495. }
  496. x-peers:empty~x-instructions {
  497. opacity: 0;
  498. }
  499. /* Responsive Styles */
  500. @media (min-height: 800px) {
  501. footer {
  502. margin-bottom: 16px;
  503. }
  504. }
  505. @media screen and (min-height: 800px),
  506. screen and (min-width: 1100px) {
  507. x-instructions:before {
  508. content: attr(desktop);
  509. }
  510. }
  511. @media (max-height: 420px) {
  512. x-instructions {
  513. top: 24px;
  514. }
  515. footer .logo {
  516. --icon-size: 40px;
  517. }
  518. }
  519. @supports (-webkit-overflow-scrolling: touch) {
  520. /* CSS specific to iOS devices */
  521. html {
  522. position: fixed;
  523. }
  524. x-instructions:before {
  525. content: attr(mobile);
  526. }
  527. }
  528. /* Default colors */
  529. body {
  530. --text-color: #333;
  531. color: #333;
  532. --bkg-color: #fafafa;
  533. background-color: #fafafa;
  534. }
  535. /* Dark theme colors */
  536. body.dark-theme {
  537. --text-color: #eee;
  538. color: #eee;
  539. --bkg-color: #121212;
  540. background-color: #121212;
  541. }
  542. /* Styles for users who prefer dark mode at the OS level */
  543. @media (prefers-color-scheme: dark) {
  544. /* defaults to dark theme */
  545. body {
  546. --text-color: #eee;
  547. color: #eee;
  548. --bkg-color: #121212;
  549. background-color: #121212;
  550. }
  551. x-dialog x-paper {
  552. --bkg-color: #333;
  553. background-color: #333;
  554. }
  555. input {
  556. --text-color: #eee;
  557. color: #eee;
  558. --bkg-color: #121212;
  559. background-color: #121212;
  560. }
  561. /* Override dark mode with light mode styles if the user decides to swap */
  562. body.light-theme {
  563. --text-color: #333;
  564. color: #333;
  565. --bkg-color: #fafafa;
  566. background-color: #fafafa;
  567. }
  568. body.light-theme x-dialog x-paper {
  569. --bkg-color: #fff;
  570. background-color: #fff;
  571. }
  572. body.light-theme input {
  573. --text-color: #333;
  574. color: #333;
  575. --bkg-color: #f1f3f4;
  576. background: #f1f3f4;
  577. }
  578. }