Skip to content

Commit

Permalink
add icons to the tabs on the plan detail page
Browse files Browse the repository at this point in the history
- changed the <input> to <div> to allow for icons
- created an InfoIcon for the info tab
- used CalendarMonthIcon for the calendar tab

note: it seems that the color of the icons is
not being styled correctly
  • Loading branch information
mikaylahubbard authored and davidmoore1 committed Aug 21, 2024
1 parent f5d9bab commit d9260cd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
14 changes: 14 additions & 0 deletions src/lib/icons/InfoIcon.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script lang="ts">
// info from https://fonts.google.com/icons
// Filled = 1
// Weight = 400
// Grade = 0
// Optical size = 24px
export let color = 'black';
</script>

<svg fill={color} xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"
><path d="M0 0h24v24H0V0z" fill="none" /><path
d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"
/></svg
>
2 changes: 2 additions & 0 deletions src/lib/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import HamburgerIcon from './HamburgerIcon.svelte';
import HighlightIcon from './HighlightIcon.svelte';
import HistoryIcon from './HistoryIcon.svelte';
import HomeIcon from './HomeIcon.svelte';
import InfoIcon from './InfoIcon.svelte';
import LaunchIcon from './LaunchIcon.svelte';
import MoreVertIcon from './MoreVertIcon.svelte';
import NoteIcon from './NoteIcon.svelte';
Expand Down Expand Up @@ -52,6 +53,7 @@ export {
HistoryIcon,
HomeIcon,
ImageIcon,
InfoIcon,
LaunchIcon,
MoreVertIcon,
NoteIcon,
Expand Down
26 changes: 16 additions & 10 deletions src/routes/plans/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import { base } from '$app/paths';
import config from '$lib/data/config';
import { compareVersions } from '$lib/scripts/stringUtils';
import { CalendarMonthIcon, InfoIcon } from '$lib/icons';
const imageFolder =
compareVersions(config.programVersion, '12.0') < 0 ? 'illustrations' : 'plans';
Expand Down Expand Up @@ -63,29 +64,34 @@
/>
</div>
{/if}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
role="tablist"
class="dy-tabs dy-tabs-bordered"
style={convertStyle($s['ui.plans.tabs'])}
>
<input
type="radio"
<!-- svelte-ignore a11y-no-static-element-interactions -->

<div
name="my_tabs_1"
role="tab"
class="dy-tab dy-tab-bordered {selectedTab === 'info' ? 'dy-tab-active' : ''}"
on:click={() => (selectedTab = 'info')}
aria-label="info logo"
aria-label="info icon"
style={convertStyle($s['ui.plans.tabs.text'])}
/>
<input
type="radio"
>
<InfoIcon style={convertStyle($s['ui.plans.tabs.icon'])}></InfoIcon>
</div>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
name="my_tabs_1"
role="tab"
class="dy-tab {selectedTab === 'calendar' ? 'dy-tab-active' : ''}"
on:click={() => (selectedTab = 'calendar')}
aria-label="calendar logo"
style={convertStyle($s['ui.plans.tabs.text'])}
/>
>
<CalendarMonthIcon style={convertStyle($s['ui.plans.tabs.icon'])}
></CalendarMonthIcon>
</div>
</div>

<div id="container" class="plan-chooser">
Expand Down

0 comments on commit d9260cd

Please sign in to comment.