tecitheme 0.11.7 → 0.11.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,14 +6,14 @@
6
6
  let id = makeIdString(data.name);
7
7
  </script>
8
8
 
9
- <div id={id} class="bg-white">
9
+ <div id={id} class="bg-white scroll-mt-16">
10
10
  <div class="mx-auto max-w-7xl divide-y divide-gray-900/10 px-6 lg:px-8">
11
- <h2 class="text-2xl font-bold leading-10 tracking-tight text-gray-900">Frequently asked questions</h2>
11
+ <h2 class="text-2xl font-bold leading-10 tracking-tight text-gray-900"><a href={`#${id}`}>{@html data.heading}</a></h2>
12
12
  <dl class="mt-10 space-y-8 divide-y divide-gray-900/10">
13
13
  <div class="pt-8 lg:grid lg:grid-cols-12 lg:gap-8">
14
14
 
15
- {#each data.items as item}
16
- <dt class="text-base font-semibold leading-7 text-gray-900 lg:col-span-5">{@html item.label}</dt>
15
+ {#each data.items as item, index}
16
+ <dt id={`${id}-list-item-${index}`} class="text-base font-semibold leading-7 text-gray-900 lg:col-span-5 scroll-mt-16"><a href={`#${id}-list-item-${index}`}>{@html item.label}</a></dt>
17
17
  <dd class="mt-4 lg:col-span-7 lg:mt-0">
18
18
  <p class="text-base leading-7 text-gray-600">{@html item.description}</p>
19
19
  </dd>
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} AnswersListProps */
2
+ /** @typedef {typeof __propDef.events} AnswersListEvents */
3
+ /** @typedef {typeof __propDef.slots} AnswersListSlots */
4
+ export default class AnswersList extends SvelteComponent<{
5
+ data?: {};
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type AnswersListProps = typeof __propDef.props;
11
+ export type AnswersListEvents = typeof __propDef.events;
12
+ export type AnswersListSlots = typeof __propDef.slots;
13
+ import { SvelteComponent } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ data?: {};
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
@@ -1,5 +1,8 @@
1
1
  <script>
2
+ import { goto } from "$app/navigation";
3
+ import { page } from "$app/stores";
2
4
  import { getColorStyles, makeIdString } from "../utils";
5
+ import { onMount } from "svelte";
3
6
  import { writable } from "svelte/store";
4
7
 
5
8
  export let data = {};
@@ -38,21 +41,21 @@
38
41
  * }
39
42
  */
40
43
  let tables = {};
41
- data.groups.forEach(section => {
42
- if (section.options)
44
+ data.groups.forEach(group => {
45
+ if (group.options)
43
46
  {
44
- tables[section.name] = {columns: [], categories: []}; //Initialize key for the section object
47
+ tables[group.name] = {name: group.name, columns: [], categories: []}; //Initialize key for the section object
45
48
 
46
- section.options.forEach(option => {
49
+ group.options.forEach(option => {
47
50
 
48
- tables[section.name]["columns"].push({name: option.name, description: option.description, highlightOption: option.highlightOption});
51
+ tables[group.name]["columns"].push({name: option.name, description: option.description, highlightOption: option.highlightOption});
49
52
 
50
53
  if (option.features) {
51
54
  option.features.forEach(category => {
52
55
 
53
56
  // Big 'ole ternary to retrieve or initialize category data
54
- let catData = tables[section.name]["categories"][category.name]
55
- ? tables[section.name]["categories"][category.name]
57
+ let catData = tables[group.name]["categories"][category.name]
58
+ ? tables[group.name]["categories"][category.name]
56
59
  : {name: category.name, features: {}};
57
60
 
58
61
  category.features.forEach((feature, index) => {
@@ -73,7 +76,7 @@
73
76
  });
74
77
 
75
78
  //Store category data
76
- tables[section.name]["categories"][category.name] = catData;
79
+ tables[group.name]["categories"][category.name] = catData;
77
80
 
78
81
  });
79
82
  }
@@ -82,17 +85,17 @@
82
85
  }
83
86
  });
84
87
 
85
- let selectedButton = writable({});
88
+ let selectedGroup = writable({});
86
89
  let selectedTable = writable({});
87
90
 
88
91
  //Initialize data stores
89
92
  if (data.groups) {
90
- selectedButton.update(val => data.groups[0]);
91
- selectedTable.update(val => tables[$selectedButton.name]);
93
+ selectedGroup.update(val => data.groups[0]);
94
+ selectedTable.update(val => tables[$selectedGroup.name]);
92
95
  }
93
96
 
94
97
  //Update table store when new button is selected
95
- selectedButton.subscribe(val => selectedTable.update(table => tables[val.name]))
98
+ selectedGroup.subscribe(val => selectedTable.update(table => tables[val.name]))
96
99
 
97
100
  /**
98
101
  *
@@ -123,6 +126,24 @@
123
126
  }
124
127
  }
125
128
 
129
+ onMount(() => {
130
+ let initialGroupParam = $page.url.searchParams.get("group");
131
+ if (initialGroupParam != null) {
132
+ let initialGroup = data.groups.filter(group => group.name === initialGroupParam)[0];
133
+ selectedGroup.update(_ => initialGroup);
134
+ }
135
+
136
+ selectedGroup.subscribe(newGroup => {
137
+ $page.url.searchParams.set("group", newGroup.name);
138
+ goto($page.url.toString(), {noScroll: true});
139
+
140
+ setTimeout(() => {
141
+ let anchorElement = document.getElementById($page.url.hash.slice(1,));
142
+ if (anchorElement) anchorElement.scrollIntoView(true);
143
+ }, 300)
144
+ })
145
+ })
146
+
126
147
  </script>
127
148
 
128
149
  <div id={id} class="relative flex flex-col space-y-4">
@@ -138,7 +159,10 @@
138
159
  <fieldset class="flex flex-row bg-white/5 text-center text-xs font-semibold leading-5 shadow-lg ring ring-gray-200/50">
139
160
  <legend class="sr-only">Group Selector</legend>
140
161
  {#each data.groups as btn}
141
- <button class="{$selectedButton === btn ? getColorStyles("background", data.color) : getColorStyles("button", "white")} px-4 py-2 transition ease-in-out duration-300" on:click={selectedButton.update(val => btn)}>
162
+ <button class="{$selectedGroup === btn ? getColorStyles("background", data.color) : getColorStyles("button", "white")} px-4 py-2 transition ease-in-out duration-300" on:click={() => {
163
+ selectedGroup.update(_ => btn);
164
+ goto($page.url.pathname + $page.url.search);
165
+ }}>
142
166
  {btn.name}
143
167
  </button>
144
168
  {/each}
@@ -152,8 +176,8 @@
152
176
 
153
177
  <div class="hidden lg:absolute lg:inset-x-px lg:bottom-0 lg:top-4 lg:block" aria-hidden="true"></div>
154
178
 
155
- {#if $selectedButton.options}
156
- {#each $selectedButton.options as card}
179
+ {#if $selectedGroup.options}
180
+ {#each $selectedGroup.options as card}
157
181
 
158
182
  <div class="relative ring-1 ring-white/30 lg:pb-14 {card.highlightOption ? getColorStyles("background", data.color) : "bg-white"} w-full shadow-lg">
159
183
  <div class="p-8 lg:pt-12 xl:p-10 xl:pt-14">
@@ -223,7 +247,14 @@
223
247
  {#each Object.values($selectedTable.categories) as category, categoryIndex}
224
248
 
225
249
  <!-- Category Name -->
226
- <h4 class="hidden sm:block sticky top-32 z-20 bg-white font-semibold leading-6 text-gray-900 px-4 py-2 w-fit">{category.name}</h4>
250
+ <div class="hidden sm:flex sticky top-32 z-20 bg-transparent flex-row">
251
+
252
+ <h4 id={makeIdString($selectedTable.name + " " + category.name)} class="scroll-mt-24 bg-white font-semibold leading-6 text-gray-900 pl-4 mr-8 py-2 w-full"><a href={"#"+makeIdString($selectedTable.name + " " + category.name)}>{category.name}</a></h4>
253
+
254
+ {#each $selectedTable.columns as col}
255
+ <div class="w-full"></div>
256
+ {/each}
257
+ </div>
227
258
 
228
259
  <!-- Table -->
229
260
  <div class="hidden relative sm:flex flex-col w-full shadow-lg">
@@ -310,7 +341,7 @@
310
341
  {#if sortFeaturesByOrder(category.features, column.name).length > 0}
311
342
 
312
343
  <!-- Category Headings -->
313
- <h4 class="sticky top-44 sm:hidden block font-semibold leading-6 text-gray-900 w-full bg-white z-20 py-2">{category.name}</h4>
344
+ <h4 id={makeIdString(column.name + " " + category.name)} class="sticky top-44 sm:hidden block font-semibold leading-6 text-gray-900 w-full bg-white z-20 py-2 scroll-mt-36"><a href={"#" + makeIdString(column.name + " " + category.name)}>{category.name}</a></h4>
314
345
 
315
346
  <div class="sm:hidden relative flex flex-col">
316
347
  <!-- Tables -->
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { default as ContentTwoColumns } from "./components/ContentTwoColumns.sve
10
10
  export { default as CountrySelector } from "./components/CountrySelector.svelte";
11
11
  export { default as CTA } from "./components/CTA.svelte";
12
12
  export { default as CTASplitImage } from "./components/CTASplitImage.svelte";
13
- export { default as FaqTable } from "./components/FAQList.svelte";
13
+ export { default as AnswersList } from "./components/AnswersList.svelte";
14
14
  export { default as FeatureGrid } from "./components/FeatureGrid.svelte";
15
15
  export { default as FeatureTable } from "./components/FeatureTable.svelte";
16
16
  export { default as Figure } from "./components/Figure.svelte";
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ export { default as ContentTwoColumns } from './components/ContentTwoColumns.sve
10
10
  export { default as CountrySelector } from './components/CountrySelector.svelte';
11
11
  export { default as CTA } from './components/CTA.svelte';
12
12
  export { default as CTASplitImage } from './components/CTASplitImage.svelte';
13
- export { default as FaqTable } from './components/FAQList.svelte';
13
+ export { default as AnswersList } from './components/AnswersList.svelte';
14
14
  export { default as FeatureGrid } from './components/FeatureGrid.svelte';
15
15
  export { default as FeatureTable } from './components/FeatureTable.svelte';
16
16
  export { default as Figure } from './components/Figure.svelte';
@@ -20,7 +20,7 @@
20
20
  import PageNav from "../components/PageNav.svelte";
21
21
  import Testimonial from "../components/Testimonial.svelte";
22
22
  import PartnersList from "../components/PartnersList.svelte";
23
- import FaqList from "../components/FAQList.svelte";
23
+ import AnswersList from "../components/AnswersList.svelte";
24
24
 
25
25
  let blocks = [
26
26
  { ref: "accordion", component: Accordion},
@@ -44,7 +44,7 @@
44
44
  { ref: "pageNav", component: PageNav },
45
45
  { ref: "testimonial", component: Testimonial },
46
46
  { ref: "partners", component: PartnersList },
47
- { ref: "faq-list", component: FaqList }
47
+ { ref: "answers-list", component: AnswersList }
48
48
  ];
49
49
 
50
50
  export let data = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tecitheme",
3
- "version": "0.11.7",
3
+ "version": "0.11.9",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -1,23 +0,0 @@
1
- /** @typedef {typeof __propDef.props} FaqListProps */
2
- /** @typedef {typeof __propDef.events} FaqListEvents */
3
- /** @typedef {typeof __propDef.slots} FaqListSlots */
4
- export default class FaqList extends SvelteComponent<{
5
- data?: {};
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {}> {
9
- }
10
- export type FaqListProps = typeof __propDef.props;
11
- export type FaqListEvents = typeof __propDef.events;
12
- export type FaqListSlots = typeof __propDef.slots;
13
- import { SvelteComponent } from "svelte";
14
- declare const __propDef: {
15
- props: {
16
- data?: {};
17
- };
18
- events: {
19
- [evt: string]: CustomEvent<any>;
20
- };
21
- slots: {};
22
- };
23
- export {};