File tree Expand file tree Collapse file tree 1 file changed +24
-18
lines changed
src/lib/components/billing Expand file tree Collapse file tree 1 file changed +24
-18
lines changed Original file line number Diff line number Diff line change 9
9
let selectedTab: Tier = BillingPlan .FREE ;
10
10
11
11
$ : plan = $plansInfo .get (selectedTab );
12
+
13
+ const allTiers: Tier [] = [BillingPlan .FREE , BillingPlan .PRO , BillingPlan .SCALE ];
14
+ $ : visibleTiers = allTiers .filter ((tier ) => tier !== BillingPlan .SCALE );
15
+
16
+ function getTierName(tier : Tier ): string {
17
+ switch (tier ) {
18
+ case BillingPlan .FREE :
19
+ return tierFree .name ;
20
+ case BillingPlan .PRO :
21
+ return tierPro .name ;
22
+ case BillingPlan .SCALE :
23
+ return tierScale .name ;
24
+ default :
25
+ return ' ' ;
26
+ }
27
+ }
12
28
</script >
13
29
14
30
<Card .Base >
15
31
<Layout .Stack >
16
32
<Tabs .Root stretch let:root >
17
- <Tabs .Item .Button
18
- {root }
19
- active ={selectedTab === BillingPlan .FREE }
20
- on:click ={() => (selectedTab = BillingPlan .FREE )}>
21
- {tierFree .name }
22
- </Tabs .Item .Button >
23
- <Tabs .Item .Button
24
- {root }
25
- active ={selectedTab === BillingPlan .PRO }
26
- on:click ={() => (selectedTab = BillingPlan .PRO )}>
27
- {tierPro .name }
28
- </Tabs .Item .Button >
29
- <Tabs .Item .Button
30
- {root }
31
- active ={selectedTab === BillingPlan .SCALE }
32
- on:click ={() => (selectedTab = BillingPlan .SCALE )}>
33
- {tierScale .name }
34
- </Tabs .Item .Button >
33
+ {#each visibleTiers as tier }
34
+ <Tabs .Item .Button
35
+ {root }
36
+ active ={selectedTab === tier }
37
+ on:click ={() => (selectedTab = tier )}>
38
+ {getTierName (tier )}
39
+ </Tabs .Item .Button >
40
+ {/each }
35
41
</Tabs .Root >
36
42
37
43
<Typography .Text variant ="m-600" >{plan .name } plan</Typography .Text >
You can’t perform that action at this time.
0 commit comments