25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

246 satır
6.5 KiB

  1. const hexColorToRGB = function(hexColor) {
  2. let detectShorthand = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; // #000 vs #000000
  3. hexColor = hexColor.replace(detectShorthand, function(m, r, g, b) {
  4. return r + r + g + g + b + b;
  5. });
  6. const hex_array = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor); // #000000 to #ffffff
  7. return hex_array
  8. ? {
  9. r: parseInt(hex_array[1], 16), // 0-255
  10. g: parseInt(hex_array[2], 16), // 0-255
  11. b: parseInt(hex_array[3], 16) // 0-255
  12. }
  13. : null;
  14. };
  15. const hexToRGBAlpha = function(hexColor, alpha) {
  16. let rgb = hexColorToRGB(hexColor);
  17. return `rgba(${rgb.r},${rgb.g},${rgb.b},${alpha})`;
  18. };
  19. const drawerWidth = 260;
  20. const transition = {
  21. transition: "all 0.33s cubic-bezier(0.685, 0.0473, 0.346, 1)"
  22. };
  23. const conatinerFluid = {
  24. paddingRight: "15px",
  25. paddingLeft: "15px",
  26. marginRight: "auto",
  27. marginLeft: "auto",
  28. width: "100%"
  29. };
  30. const container = {
  31. ...conatinerFluid,
  32. "@media (min-width: 576px)": {
  33. maxWidth: "540px"
  34. },
  35. "@media (min-width: 768px)": {
  36. maxWidth: "720px"
  37. },
  38. "@media (min-width: 992px)": {
  39. maxWidth: "960px"
  40. },
  41. "@media (min-width: 1200px)": {
  42. maxWidth: "1140px"
  43. }
  44. };
  45. const boxShadow = {
  46. boxShadow:
  47. "0 10px 30px -12px rgba(0, 0, 0, 0.42), 0 4px 25px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2)"
  48. };
  49. const card = {
  50. display: "inline-block",
  51. position: "relative",
  52. width: "100%",
  53. margin: "25px 0",
  54. boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.14)",
  55. borderRadius: "3px",
  56. color: "rgba(0, 0, 0, 0.87)",
  57. background: "#fff"
  58. };
  59. const defaultFont = {
  60. fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
  61. fontWeight: "300",
  62. lineHeight: "1.5em"
  63. };
  64. const primaryColor = "#212121";
  65. const warningColor = "#ff9800";
  66. const dangerColor = "#f44336";
  67. const successColor = "#4caf50";
  68. const infoColor = "#212121";
  69. const roseColor = "#e91e63";
  70. const grayColor = "#999999";
  71. const primaryBoxShadow = {
  72. boxShadow: `0 12px 20px -10px ${hexToRGBAlpha(
  73. primaryColor,
  74. 0.28
  75. )}, 0 4px 20px 0px rgba(0, 0, 0, 0.12), 0 7px 8px -5px ${hexToRGBAlpha(
  76. primaryColor,
  77. 0.2
  78. )}`
  79. };
  80. const infoBoxShadow = {
  81. boxShadow: `0 12px 20px -10px ${hexToRGBAlpha(
  82. infoColor,
  83. 0.28
  84. )}, 0 4px 20px 0px rgba(0, 0, 0, 0.12), 0 7px 8px -5px ${hexToRGBAlpha(
  85. infoColor,
  86. 0.2
  87. )}`
  88. };
  89. const successBoxShadow = {
  90. boxShadow: `0 12px 20px -10px ${hexToRGBAlpha(
  91. successColor,
  92. 0.28
  93. )}, 0 4px 20px 0px rgba(0, 0, 0, 0.12), 0 7px 8px -5px ${hexToRGBAlpha(
  94. successColor,
  95. 0.2
  96. )}`
  97. };
  98. const warningBoxShadow = {
  99. boxShadow: `0 12px 20px -10px ${hexToRGBAlpha(
  100. warningColor,
  101. 0.28
  102. )}, 0 4px 20px 0px rgba(0, 0, 0, 0.12), 0 7px 8px -5px ${hexToRGBAlpha(
  103. warningColor,
  104. 0.2
  105. )}`
  106. };
  107. const dangerBoxShadow = {
  108. boxShadow: `0 12px 20px -10px ${hexToRGBAlpha(
  109. dangerColor,
  110. 0.28
  111. )}, 0 4px 20px 0px rgba(0, 0, 0, 0.12), 0 7px 8px -5px ${hexToRGBAlpha(
  112. dangerColor,
  113. 0.2
  114. )}`
  115. };
  116. const roseBoxShadow = {
  117. boxShadow: `0 4px 20px 0px ${hexToRGBAlpha(
  118. "#000",
  119. 0.14
  120. )}, 0 7px 10px -5px ${hexToRGBAlpha(roseColor, 0.4)}`
  121. };
  122. const warningCardHeader = {
  123. color: "#fff",
  124. background: "linear-gradient(60deg, #ffa726, #fb8c00)",
  125. ...warningBoxShadow
  126. };
  127. const successCardHeader = {
  128. color: "#fff",
  129. background: "linear-gradient(60deg, #66bb6a, #43a047)",
  130. ...successBoxShadow
  131. };
  132. const dangerCardHeader = {
  133. color: "#fff",
  134. background: "linear-gradient(60deg, #ef5350, #e53935)",
  135. ...dangerBoxShadow
  136. };
  137. const infoCardHeader = {
  138. color: "#fff",
  139. background: "#212121",
  140. ...infoBoxShadow
  141. };
  142. const primaryCardHeader = {
  143. color: "#fff",
  144. background: "linear-gradient(60deg, #ab47bc, #8e24aa)",
  145. ...primaryBoxShadow
  146. };
  147. const roseCardHeader = {
  148. color: "#fff",
  149. background: "linear-gradient(60deg, #ec407a, #d81b60)",
  150. ...roseBoxShadow
  151. };
  152. const cardActions = {
  153. margin: "0 20px 10px",
  154. paddingTop: "10px",
  155. borderTop: "1px solid #eeeeee",
  156. height: "auto",
  157. ...defaultFont
  158. };
  159. const cardHeader = {
  160. margin: "-30px 15px 0",
  161. borderRadius: "3px",
  162. padding: "15px"
  163. };
  164. const defaultBoxShadow = {
  165. border: "0",
  166. borderRadius: "3px",
  167. boxShadow:
  168. "0 10px 20px -12px rgba(0, 0, 0, 0.42), 0 3px 20px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2)",
  169. padding: "10px 0",
  170. transition: "all 150ms ease 0s"
  171. };
  172. const title = {
  173. color: "#3C4858",
  174. margin: "1.75rem 0 0.875rem",
  175. textDecoration: "none",
  176. fontWeight: "700",
  177. fontFamily: `"Roboto Slab", "Times New Roman", serif`
  178. };
  179. const cardTitle = {
  180. ...title,
  181. marginTop: ".625rem"
  182. };
  183. const cardLink = {
  184. "& + $cardLink": {
  185. marginLeft: "1.25rem"
  186. }
  187. };
  188. const cardSubtitle = {
  189. marginBottom: "0",
  190. marginTop: "-.375rem"
  191. };
  192. export {
  193. hexToRGBAlpha,
  194. //variables
  195. drawerWidth,
  196. transition,
  197. container,
  198. conatinerFluid,
  199. boxShadow,
  200. card,
  201. defaultFont,
  202. primaryColor,
  203. warningColor,
  204. dangerColor,
  205. successColor,
  206. infoColor,
  207. roseColor,
  208. grayColor,
  209. primaryBoxShadow,
  210. infoBoxShadow,
  211. successBoxShadow,
  212. warningBoxShadow,
  213. dangerBoxShadow,
  214. roseBoxShadow,
  215. warningCardHeader,
  216. successCardHeader,
  217. dangerCardHeader,
  218. infoCardHeader,
  219. primaryCardHeader,
  220. roseCardHeader,
  221. cardActions,
  222. cardHeader,
  223. defaultBoxShadow,
  224. title,
  225. cardTitle,
  226. cardLink,
  227. cardSubtitle
  228. };