Skip to content

Commit

Permalink
Use dynamic class and reactive expression
Browse files Browse the repository at this point in the history
  • Loading branch information
4lm committed Jul 13, 2019
1 parent 8620754 commit c8d4034
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion udemy/assignment01/src/CourseGoal.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script>
export let goal;
$: hasExclamation = goal.includes('!');
</script>

<style>
Expand All @@ -8,4 +10,4 @@
}
</style>

<h1 class={goal.includes('!') ? 'exclamation' : ''}>{goal}</h1>
<h1 class:exclamation={hasExclamation}>{goal}</h1>

0 comments on commit c8d4034

Please sign in to comment.