tailwind.config.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. textShadow: {},
  64. keyframes: keyframes,
  65. animation: {
  66. "slow-bounce": "slow-bounce 1s linear infinite",
  67. "slow-shake": "shake 0.8s ease-in-out infinite",
  68. },
  69. },
  70. colors: {
  71. "primary-color": "var(--primary-color)",
  72. "linear-color": "linear-gradient(180deg, #ffaa30, #ffe6be)",
  73. },
  74. },
  75. plugins: [
  76. plugin(function ({ addUtilities }: any) {
  77. addUtilities({
  78. "text-stroke": {
  79. webkitTextStroke: "1px #fff",
  80. },
  81. });
  82. }),
  83. ],
  84. };
  85. export default config;