Skip to content

Commit

Permalink
use a class name element directive
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Liendo committed Nov 13, 2023
1 parent f26ca00 commit ad0baec
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/lib/components/NotificationList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@
BottomRight = 'bottom_right',
BottomLeft = 'bottom_left',
}
export function getPositionClasses(position: Position = Position.TopRight) {
switch (position) {
case Position.TopRight:
return 'position-top-right';
case Position.TopLeft:
return 'position-top-left';
case Position.BottomRight:
return 'position-bottom-right';
case Position.BottomLeft:
return 'position-bottom-left';
default:
return 'position-top-right';
}
}
</script>

<script lang="ts">
Expand Down Expand Up @@ -48,7 +33,11 @@
</script>

<ul
class={` ${className} ${getPositionClasses(position)}`}
class={className}
class:position-top-right={position === Position.TopRight}
class:position-top-left={position === Position.TopLeft}
class:position-bottom-right={position === Position.BottomRight}
class:position-bottom-left={position === Position.BottomLeft}
class:z-index={notificationsList?.length}
{style}
>
Expand Down

0 comments on commit ad0baec

Please sign in to comment.