Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇

2.1 KB
Raw Blame
// ===================
// © AngelaMos | 2026
// _mixins.scss
// ===================

@use 'sass:map';
@use 'sass:list';
@use 'tokens' as *;

$breakpoints: (
  'xs': $breakpoint-xs,
  'sm': $breakpoint-sm,
  'md': $breakpoint-md,
  'lg': $breakpoint-lg,
  'xl': $breakpoint-xl,
  '2xl': $breakpoint-2xl,
);

@mixin breakpoint-up($size) {
  @media (min-width: map.get($breakpoints, $size)) {
    @content;
  }
}

@mixin breakpoint-down($size) {
  @media (width < map.get($breakpoints, $size)) {
    @content;
  }
}

@mixin flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

@mixin flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@mixin flex-column {
  display: flex;
  flex-direction: column;
}

@mixin flex-column-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@mixin sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@mixin truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@mixin line-clamp($lines: 2) {
  display: -webkit-box;
  -webkit-line-clamp: #{$lines};
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@mixin transition-fast {
  transition-property: background-color, border-color, color, opacity;
  transition-duration: $duration-fast;
  transition-timing-function: $ease-out;
}

@mixin transition-normal {
  transition-property: background-color, border-color, color, opacity;
  transition-duration: $duration-normal;
  transition-timing-function: $ease-out;
}

@mixin absolute-fill {
  position: absolute;
  inset: 0;
}

@mixin absolute-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@mixin hover {
  @media (hover: hover) and (pointer: fine) {
    &:hover {
      @content;
    }
  }
}

@mixin hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }
}