calc-math.scss 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. @function calc-sum($one, $two) {
  2. @if $one != null and $two != null {
  3. @if $one == 0 {
  4. @return $two;
  5. }
  6. @if $two == 0 {
  7. @return $one;
  8. }
  9. // TODO if units are the same no need to use calc
  10. @return calc(#{$one} + #{$two});
  11. }
  12. @if $one != null {
  13. @return $one;
  14. }
  15. @if $two != null {
  16. @return $two;
  17. }
  18. @return null;
  19. }
  20. @function calc-diff($one, $two) {
  21. @if $one != null and $two != null {
  22. @if $one == 0 {
  23. @return $two;
  24. }
  25. @if $two == 0 {
  26. @return $one;
  27. }
  28. // TODO if units are the same no need to use calc
  29. @return calc(#{$one} - #{$two});
  30. }
  31. @if $one != null {
  32. @return $one;
  33. }
  34. @if $two != null {
  35. @return $two;
  36. }
  37. @return null;
  38. }
  39. @function add-if ($value1, $value2) {
  40. @if $value1 == null or $value2 == null {
  41. @return null;
  42. }
  43. @return $value1 + $value2;
  44. }