Skip to content

Commit

Permalink
add goal icons to Select Goal
Browse files Browse the repository at this point in the history
  • Loading branch information
fivaz committed May 20, 2024
1 parent 453b33e commit 967f400
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
tailwindColors[event.category.color].hoverBg,
)}
>
<div class="flex gap-1">
<div class="flex items-center gap-1">
{#if event.goal?.icon}
<GoalIcon class="h-5 w-5" name={event.goal.icon} />
<GoalIcon class="h-4 w-4" name={event.goal.icon} />
{/if}
<span class="truncate pr-3 font-semibold">
{getTitle()}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/select/select-item/SelectItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'relative cursor-default select-none py-2 pl-3 pr-9',
)}
>
<span class={clsx(active ? 'font-semibold' : 'font-normal', 'block truncate', className)}>
<span class={clsx(active ? 'font-semibold' : 'font-normal', 'truncate', className)}>
<slot />
</span>

Expand Down
7 changes: 6 additions & 1 deletion src/lib/components/task-form/TaskForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import { Icon } from '@steeze-ui/svelte-icon';
import { createEventDispatcher } from 'svelte';
import GoalIcon from '../../../routes/dashboard/goals/goal-form/goal-icon/GoalIcon.svelte';
export let task: AnyTask;
export let goals: Goal[];
Expand Down Expand Up @@ -155,7 +157,10 @@
<span slot="placeholder">{taskIn.goal?.name || 'no goal'}</span>
<SelectItem value={null}>no goal</SelectItem>
{#each goals as goal (goal)}
<SelectItem value={goal}>{goal.name}</SelectItem>
<SelectItem class="flex gap-2" value={goal}>
<GoalIcon class="h-5 w-5" name={goal.icon} />
<span class="w-[calc(100%-20px)] truncate">{goal.name}</span>
</SelectItem>
{/each}
</Select>

Expand Down
1 change: 0 additions & 1 deletion src/routes/dashboard/goals/goal-form/goal-icon/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const icons: GoalIconType[] = [
{ component: Dumbbell, name: 'Weightlifting Barbell' },
{ component: Paintbrush, name: 'Paintbrush' },
{ component: MoneyBill1Wave, name: 'Money' },
{ component: Globe, name: 'Globe' },
{ component: Book, name: 'Book' },
{ component: Stopwatch, name: 'Stopwatch' },
{ component: Lightbulb, name: 'Lightbulb', theme: 'default' },
Expand Down

0 comments on commit 967f400

Please sign in to comment.