dock-surface.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { type ComponentProps, splitProps } from "solid-js"
  2. export interface DockTrayProps extends ComponentProps<"div"> {
  3. attach?: "none" | "top"
  4. }
  5. export function DockShell(props: ComponentProps<"div">) {
  6. const [split, rest] = splitProps(props, ["children", "class", "classList"])
  7. return (
  8. <div
  9. {...rest}
  10. data-dock-surface="shell"
  11. classList={{
  12. ...(split.classList ?? {}),
  13. [split.class ?? ""]: !!split.class,
  14. }}
  15. >
  16. {split.children}
  17. </div>
  18. )
  19. }
  20. export function DockShellForm(props: ComponentProps<"form">) {
  21. const [split, rest] = splitProps(props, ["children", "class", "classList"])
  22. return (
  23. <form
  24. {...rest}
  25. data-dock-surface="shell"
  26. classList={{
  27. ...(split.classList ?? {}),
  28. [split.class ?? ""]: !!split.class,
  29. }}
  30. >
  31. {split.children}
  32. </form>
  33. )
  34. }
  35. export function DockTray(props: DockTrayProps) {
  36. const [split, rest] = splitProps(props, ["attach", "children", "class", "classList"])
  37. return (
  38. <div
  39. {...rest}
  40. data-dock-surface="tray"
  41. data-dock-attach={split.attach || "none"}
  42. classList={{
  43. ...(split.classList ?? {}),
  44. [split.class ?? ""]: !!split.class,
  45. }}
  46. >
  47. {split.children}
  48. </div>
  49. )
  50. }