styles.css 12 KB

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