styled.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* eslint-disable consistent-return */
  2. import { createGlobalStyle, css } from 'styled-components';
  3. export const mediaRule = {
  4. mobileS: '320px',
  5. mobileM: '375px',
  6. mobileL: '425px',
  7. tablet: '768px',
  8. laptop: '1024px',
  9. desktop: '1440px',
  10. };
  11. export const theme = {
  12. primary: '#00bfa5',
  13. secondary: '#2d3e4e',
  14. success: '#b8e986',
  15. error: '#ff3b30',
  16. warning: '#ffc107',
  17. sicklyGreen: '#8ec31f',
  18. normal: '#828282',
  19. progress: '#acda33',
  20. };
  21. export const GlobalStyle = createGlobalStyle`
  22. html, body {
  23. margin: 0;
  24. background-color: #f8f8f8;
  25. height: 100%;
  26. font-size: 14px;
  27. & > div {
  28. height: 100%;
  29. }
  30. }
  31. ${({ lang }) => {
  32. if (lang === 'zh-tw') return css`@import url('https://fonts.googleapis.com/css?family=Noto+Sans+TC:300,400,700&display=swap');`;
  33. if (lang === 'zh-cn') return css`@import url('https://fonts.googleapis.com/css?family=Noto+Sans+SC:300,400,700&display=swap');`;
  34. if (lang === 'ja') return css`@import url('https://fonts.googleapis.com/css?family=Noto+Sans+JP:300,400,700&display=swap');`;
  35. if (lang === 'en') return css`@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,700&display=swap');`;
  36. }}
  37. &:lang(en) {
  38. font-family: 'Open Sans', sans-serif;
  39. }
  40. &:lang(zh-tw) {
  41. font-family: 'Noto Sans TC', sans-serif;
  42. }
  43. &:lang(zh-cn) {
  44. font-family: 'Noto Sans SC', sans-serif;
  45. }
  46. &:lang(ja) {
  47. font-family: 'Noto Sans JP', sans-serif;
  48. }
  49. `;
  50. export default GlobalStyle;