Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
d5c0876a
Commit
d5c0876a
authored
Jul 04, 2024
by
rdavis
Browse files
refactor: fixed new Collapsible Component to allow passed in classes
chore: format
parent
2389c36a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
98 deletions
+91
-98
src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte
...nts/chat/Messages/ResponseMessage/WebSearchResults.svelte
+76
-82
src/lib/components/common/Collapsible.svelte
src/lib/components/common/Collapsible.svelte
+15
-16
No files found.
src/lib/components/chat/Messages/ResponseMessage/WebSearchResults.svelte
View file @
d5c0876a
...
...
@@ -4,13 +4,11 @@
import MagnifyingGlass from '$lib/components/icons/MagnifyingGlass.svelte';
import Collapsible from '$lib/components/common/Collapsible.svelte';
export let status = { urls: [], query: '' };
let state = false;
</script>
<div class="w-full space-y-1">
<Collapsible bind:open={state}>
<Collapsible bind:open={state} className="w-full space-y-1">
<div
class="flex items-center gap-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
slot="head"
...
...
@@ -23,10 +21,7 @@
<ChevronDown strokeWidth="3.5" className="size-3.5 " />
{/if}
</div>
<div
class="text-sm border border-gray-300/30 dark:border-gray-700/50 rounded-xl"
slot="content"
>
<div class="text-sm border border-gray-300/30 dark:border-gray-700/50 rounded-xl" slot="content">
{#if status?.query}
<a
href="https://www.google.com/search?q={status.query}"
...
...
@@ -93,5 +88,4 @@
</a>
{/each}
</div>
</Collapsible>
</div>
\ No newline at end of file
</Collapsible>
src/lib/components/common/Collapsible.svelte
View file @
d5c0876a
...
...
@@ -2,7 +2,7 @@
import { afterUpdate } from 'svelte';
export let open = false;
export let className = '';
// Manage the max-height of the collapsible content for snappy transitions
let contentElement: HTMLElement;
...
...
@@ -16,9 +16,17 @@
maxHeight = '0px';
}
});
</script>
<div class={className}>
<button on:click={() => (open = !open)}>
<slot name="head" />
</button>
<div bind:this={contentElement} class="collapsible-content" style="max-height: {maxHeight};">
<slot name="content" />
</div>
</div>
<style>
.collapsible-content {
overflow: hidden;
...
...
@@ -26,12 +34,3 @@
max-height: 0;
}
</style>
<div>
<button on:click={() => open = !open}>
<slot name="head"></slot>
</button>
<div bind:this={contentElement} class="collapsible-content" style="max-height: {maxHeight};">
<slot name="content"></slot>
</div>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment