2
0

♻️ Re-organize workspace folders

This commit is contained in:
Baptiste Arnaud
2023-03-15 08:35:16 +01:00
parent 25c367901f
commit cbc8194f19
987 changed files with 2716 additions and 2770 deletions

View File

@@ -0,0 +1,48 @@
import styles from '../../../assets/index.css'
import { Bot, BotProps } from '@/components/Bot'
import { createSignal, onCleanup, onMount, Show } from 'solid-js'
const hostElementCss = `
:host {
display: block;
width: 100%;
height: 100%;
overflow-y: hidden;
}
`
export const Standard = (
props: BotProps,
{ element }: { element: HTMLElement }
) => {
const [isBotDisplayed, setIsBotDisplayed] = createSignal(false)
const launchBot = () => {
setIsBotDisplayed(true)
}
const botLauncherObserver = new IntersectionObserver((intersections) => {
if (intersections.some((intersection) => intersection.isIntersecting))
launchBot()
})
onMount(() => {
botLauncherObserver.observe(element)
})
onCleanup(() => {
botLauncherObserver.disconnect()
})
return (
<>
<style>
{styles}
{hostElementCss}
</style>
<Show when={isBotDisplayed()}>
<Bot {...props} />
</Show>
</>
)
}

View File

@@ -0,0 +1 @@
export * from './Standard'

View File

@@ -0,0 +1 @@
export * from './components'