-
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.
- Loading branch information
Showing
11 changed files
with
1,437 additions
and
123 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,40 @@ | ||
<script> | ||
import BookmarkFolderTree from "./tree/BookmarkFolderTree.svelte"; | ||
import {onMount} from "svelte"; | ||
let nodes = []; | ||
onMount(async () => { | ||
chrome.bookmarks.getTree(function (results) { | ||
console.log("populate tree with resuts: %o", results) | ||
nodes = [...results[0].children] | ||
}); | ||
}) | ||
</script> | ||
|
||
|
||
<div class="flex flex-wrap -m-2"> | ||
<div class="p-2 w-full"> | ||
<BookmarkFolderTree bind:nodes={nodes}/> | ||
</div> | ||
|
||
<div class="flex justify-between items-center p-2 mx-2 space-x-2 w-full"> | ||
<div class="flex-none"> | ||
<button class="btn btn-primary">New Folder</button> | ||
</div> | ||
<div class="grow"> | ||
| ||
</div> | ||
<div class="flex-none"> | ||
<div class="flex justify-end items-center space-x-2"> | ||
<button class="btn btn-primary">Cancel</button> | ||
<button class="btn btn-primary">Choose</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
|
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,11 @@ | ||
<script> | ||
import Node from "./BookmarkNode.svelte"; | ||
export let nodes = []; | ||
</script> | ||
|
||
<ul class="m-1 p-1"> | ||
{#each nodes as node} | ||
<Node bind:node={node}/> | ||
{/each} | ||
</ul> |
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,46 @@ | ||
<script> | ||
import {slide} from 'svelte/transition'; | ||
import ParentFolderIcon from './ParentFolderIcon.svelte'; | ||
import LeafFolderIcon from './LeafFolderIcon.svelte'; | ||
export let node; | ||
export let level = 0; | ||
let expanded = false; | ||
function toggle() { | ||
expanded = !expanded; | ||
if(expanded) { | ||
chrome.bookmarks.getSubTree(node.id, function (results){ | ||
console.log(`subtree of ${node.title} is: %o`, results) | ||
}) | ||
} | ||
} | ||
</script> | ||
|
||
<li on:click={toggle} style="padding-left:{level*1}rem" class="cursor-pointer" transition:slide> | ||
<div class="flex bg-gray-100 text-center justify-center"> | ||
{#if node.children && node.children.length } | ||
<ParentFolderIcon/> | ||
{:else} | ||
<LeafFolderIcon/> | ||
{/if} | ||
<span>{node.title}</span> | ||
</div> | ||
</li> | ||
|
||
<!--{#if node.children && expanded}--> | ||
<!-- {#each node.children as child}--> | ||
<!-- <svelte:self node={child} level={level+1}/>--> | ||
<!-- {/each}--> | ||
<!--{/if}--> | ||
|
||
<style> | ||
li { | ||
border-bottom: solid 1px #eee; | ||
margin: 0 0; | ||
padding: 1rem; | ||
background: #fafafa; | ||
display: flex; | ||
} | ||
</style> |
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,3 @@ | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> | ||
<path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" /> | ||
</svg> |
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,3 @@ | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> | ||
<path fill-rule="evenodd" d="M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V8a2 2 0 00-2-2h-5L9 4H4zm7 5a1 1 0 10-2 0v1H8a1 1 0 100 2h1v1a1 1 0 102 0v-1h1a1 1 0 100-2h-1V9z" /> | ||
</svg> |