radius.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { unit } from '@ant-design/cssinjs';
  2. const genRadiusStyle = token => {
  3. const {
  4. componentCls,
  5. tableRadius
  6. } = token;
  7. return {
  8. [`${componentCls}-wrapper`]: {
  9. [componentCls]: {
  10. // https://github.com/ant-design/ant-design/issues/39115#issuecomment-1362314574
  11. [`${componentCls}-title, ${componentCls}-header`]: {
  12. borderRadius: `${unit(tableRadius)} ${unit(tableRadius)} 0 0`
  13. },
  14. [`${componentCls}-title + ${componentCls}-container`]: {
  15. borderStartStartRadius: 0,
  16. borderStartEndRadius: 0,
  17. // https://github.com/ant-design/ant-design/issues/41975
  18. [`${componentCls}-header, table`]: {
  19. borderRadius: 0
  20. },
  21. 'table > thead > tr:first-child': {
  22. 'th:first-child, th:last-child, td:first-child, td:last-child': {
  23. borderRadius: 0
  24. }
  25. }
  26. },
  27. '&-container': {
  28. borderStartStartRadius: tableRadius,
  29. borderStartEndRadius: tableRadius,
  30. 'table > thead > tr:first-child': {
  31. '> *:first-child': {
  32. borderStartStartRadius: tableRadius
  33. },
  34. '> *:last-child': {
  35. borderStartEndRadius: tableRadius
  36. }
  37. }
  38. },
  39. '&-footer': {
  40. borderRadius: `0 0 ${unit(tableRadius)} ${unit(tableRadius)}`
  41. }
  42. }
  43. }
  44. };
  45. };
  46. export default genRadiusStyle;