Skip to content

Commit

Permalink
use content switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
hslee2008 committed Jul 4, 2024
1 parent 20d6de2 commit e4aef73
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { MetaTags } from "svelte-meta-tags";
import { Tabs, Tab, TabList, TabPanel } from "hyunseung-svelte-tabs";
import { GoogleAnalytics } from "hyunseung-svelte-google-analytics";
import { ContentSwitcher, Switch } from "carbon-components-svelte";
import Finals from "@/lib/Finals.svelte";
import Grade from "@/lib/Grade.svelte";
Expand All @@ -21,6 +22,7 @@
initializeFirebasePerformance();
let isOnline = true;
let selectedIndex = 0;
onMount(() => {
document.documentElement.lang = currentLocale;
Expand All @@ -47,20 +49,18 @@

{#if isOnline}
<main>
<Tabs>
<TabList>
<Tab>{$_("expected_finals_score")}</Tab>
<Tab>{$_("total_grade")}</Tab>
</TabList>
<ContentSwitcher bind:selectedIndex>
<Switch text={$_("expected_finals_score")} />
<Switch text={$_("total_grade")} />
</ContentSwitcher>

<TabPanel>
<Finals></Finals>
</TabPanel>
<br />

<TabPanel>
<Grade></Grade>
</TabPanel>
</Tabs>
{#if selectedIndex === 0}
<Finals></Finals>
{:else if selectedIndex === 1}
<Grade></Grade>
{/if}
</main>
{:else}
<h1>{$_("offline")}</h1>
Expand Down

0 comments on commit e4aef73

Please sign in to comment.