-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show skills corresponding to project
- Loading branch information
1 parent
cf3a629
commit 7122e09
Showing
4 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import shownProjects from "$lib/data/projects"; | ||
import { writable, derived } from "svelte/store"; | ||
import type { Writable, Readable } from "svelte/store"; | ||
|
||
const currentlySelectedProjectName : Writable<string | null> = writable(null); | ||
|
||
const activeSkillNames : Readable<string[]> = derived(currentlySelectedProjectName, ($currentlySelectedProjectName) => { | ||
if ($currentlySelectedProjectName === null) return []; | ||
const activeProject = shownProjects.find((project) => project.name === $currentlySelectedProjectName); | ||
if (activeProject === undefined) return []; | ||
return activeProject.relevantSkillNames; | ||
}); | ||
|
||
const isActive = (skillName: string) => derived(activeSkillNames, ($activeSkillNames) => $activeSkillNames.includes(skillName)); | ||
|
||
export { currentlySelectedProjectName, activeSkillNames, isActive }; |