_border-radius.less 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // Single side border-radius
  2. #border-radius(@radius: @border-radius, @fallback-border-radius: false) {
  3. & when (@enable-rounded) {
  4. & when (isnumber(@radius)) {
  5. border-radius: max(0, @radius);
  6. }
  7. & when not (isnumber(@radius)) {
  8. border-radius: @radius;
  9. }
  10. }
  11. & when not (@enable-rounded) and not (@fallback-border-radius = false) {
  12. border-radius: @fallback-border-radius;
  13. }
  14. }
  15. #border-top-radius(@radius) {
  16. & when (@enable-rounded) {
  17. & when (isnumber(@radius)) {
  18. border-top-left-radius: max(0, @radius);
  19. border-top-right-radius: max(0, @radius);
  20. }
  21. & when not (isnumber(@radius)) {
  22. border-top-left-radius: @radius;
  23. border-top-right-radius: @radius;
  24. }
  25. }
  26. }
  27. #border-right-radius(@radius) {
  28. & when (@enable-rounded) {
  29. & when (isnumber(@radius)) {
  30. border-top-right-radius: max(0, @radius);
  31. border-bottom-right-radius: max(0, @radius);
  32. }
  33. & when not (isnumber(@radius)) {
  34. border-top-right-radius: @radius;
  35. border-bottom-right-radius: @radius;
  36. }
  37. }
  38. }
  39. #border-bottom-radius(@radius) {
  40. & when (@enable-rounded) {
  41. & when (isnumber(@radius)) {
  42. border-bottom-right-radius: max(0, @radius);
  43. border-bottom-left-radius: max(0, @radius);
  44. }
  45. & when not (isnumber(@radius)) {
  46. border-bottom-right-radius: @radius;
  47. border-bottom-left-radius: @radius;
  48. }
  49. }
  50. }
  51. #border-left-radius(@radius) {
  52. & when (@enable-rounded) {
  53. & when (isnumber(@radius)) {
  54. border-top-left-radius: max(0, @radius);
  55. border-bottom-left-radius: max(0, @radius);
  56. }
  57. & when not (isnumber(@radius)) {
  58. border-top-left-radius: @radius;
  59. border-bottom-left-radius: @radius;
  60. }
  61. }
  62. }
  63. #border-top-left-radius(@radius) {
  64. & when (@enable-rounded) {
  65. & when (isnumber(@radius)) {
  66. border-top-left-radius: max(0, @radius);
  67. }
  68. & when not (isnumber(@radius)) {
  69. border-top-left-radius: @radius;
  70. }
  71. }
  72. }
  73. #border-top-right-radius(@radius) {
  74. & when (@enable-rounded) {
  75. & when (isnumber(@radius)) {
  76. border-top-right-radius: max(0, @radius);
  77. }
  78. & when not (isnumber(@radius)) {
  79. border-top-right-radius: @radius;
  80. }
  81. }
  82. }
  83. #border-bottom-right-radius(@radius) {
  84. & when (@enable-rounded) {
  85. & when (isnumber(@radius)) {
  86. border-bottom-right-radius: max(0, @radius);
  87. }
  88. & when not (isnumber(@radius)) {
  89. border-bottom-right-radius: @radius;
  90. }
  91. }
  92. }
  93. #border-bottom-left-radius(@radius) {
  94. & when (@enable-rounded) {
  95. & when (isnumber(@radius)) {
  96. border-bottom-left-radius: max(0, @radius);
  97. }
  98. & when not (isnumber(@radius)) {
  99. border-bottom-left-radius: @radius;
  100. }
  101. }
  102. }