tailwind.config.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import type { Config } from "tailwindcss";
  2. const plugin = require("tailwindcss/plugin");
  3. const MAX_WIDTH = 1440;
  4. const toRem = (px: number) => {
  5. return `${((4 * px) / (MAX_WIDTH / 10)).toFixed(2)}rem`;
  6. };
  7. const keyframes = {
  8. "slow-bounce": {
  9. "0%,100%": {
  10. transform: "translateY(-10px)",
  11. animationTimingFunction: "cubic-bezier(0.8, 0, 1, 1)",
  12. },
  13. "50%": {
  14. transform: "none",
  15. animationTimingFunction: "cubic-bezier(0, 0, 0.2, 1)",
  16. },
  17. },
  18. shake: {
  19. "10%,90% ": {
  20. transform: "translate3d(-1px, 0, 0) rotate(-1deg)",
  21. },
  22. "20%,80%": {
  23. transform: "translate3d(2px, 0, 0) rotate(1deg)",
  24. },
  25. "30%,70%": {
  26. transform: "translate3d(-3px, 0, 0) rotate(-3deg)",
  27. },
  28. "40%,60%": {
  29. transform: "translate3d(3px, 0, 0) rotate(1deg)",
  30. },
  31. "50%": {
  32. transform: "translate3d(-3px, 0, 0) rotate(3deg)",
  33. },
  34. },
  35. };
  36. const size: any = Array.from({ length: 100 }).reduce((map: any, _, index) => {
  37. map[index] = toRem(index);
  38. return map;
  39. }, {});
  40. // 0.0694rem
  41. const config: Config = {
  42. content: [
  43. "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
  44. "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
  45. "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  46. ],
  47. theme: {
  48. // space: size,
  49. // padding: size,
  50. // height: size,
  51. // minWidth: size,
  52. // lineHeight: size,
  53. // width: size,
  54. // gap: size,
  55. // minHeight: size,
  56. // fontSize: size,
  57. extend: {
  58. backgroundImage: {
  59. "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
  60. "gradient-conic":
  61. "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
  62. },
  63. padding: {
  64. "spacing-x": "0.12rem",
  65. "spacing-y": "0.08rem",
  66. },
  67. textShadow: {},
  68. keyframes: keyframes,
  69. animation: {
  70. "slow-bounce": "slow-bounce 1s linear infinite",
  71. "slow-shake": "shake 0.8s ease-in-out infinite",
  72. },
  73. },
  74. colors: {
  75. "primary-color": "var(--primary-color)",
  76. "bg-color": "var(--bg-color)",
  77. "bg-block-color": "var(--bg-block-color)",
  78. "linear-color": "linear-gradient(180deg, #ffaa30, #ffe6be)",
  79. },
  80. },
  81. plugins: [
  82. plugin(function ({ addUtilities }: any) {
  83. addUtilities({
  84. "text-stroke": {
  85. webkitTextStroke: "1px #fff",
  86. },
  87. });
  88. }),
  89. ],
  90. };
  91. export default config;