Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plate Editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projekt HeadlessCMS-WS24-25
Plate Editor
Commits
7268e5f1
Commit
7268e5f1
authored
2 months ago
by
Leon Jung
Browse files
Options
Downloads
Patches
Plain Diff
refactor popover and table components for improved structure and functionality
parent
e53d4aa6
Branches
main
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/plate-ui/popover.tsx
+2
-2
2 additions, 2 deletions
src/components/plate-ui/popover.tsx
src/components/plate-ui/table-element.tsx
+37
-28
37 additions, 28 deletions
src/components/plate-ui/table-element.tsx
with
39 additions
and
30 deletions
src/components/plate-ui/popover.tsx
+
2
−
2
View file @
7268e5f1
...
...
@@ -13,7 +13,7 @@ export const PopoverTrigger = PopoverPrimitive.Trigger;
export
const
PopoverAnchor
=
PopoverPrimitive
.
Anchor
;
export
const
popoverVariants
=
cva
(
'
z-50 w-72 rounded-md border border-zinc-200 bg-white p-4 text-zinc-950 shadow-md outline-none print:hidden dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50
'
,
'
z-50 w-72 rounded-md border border-zinc-200 bg-white p-4 text-zinc-950 shadow-md outline-none print:hidden dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50
'
,
{
defaultVariants
:
{
animate
:
true
,
...
...
@@ -29,7 +29,7 @@ export const popoverVariants = cva(
export
const
PopoverContent
=
withRef
<
typeof
PopoverPrimitive
.
Content
,
VariantProps
<
typeof
popoverVariants
>
>
(({
align
=
'
center
'
,
animate
,
className
,
sideOffset
=
4
,
...
props
},
ref
)
=>
(
>
(({
align
=
'
center
'
,
animate
,
className
,
sideOffset
=
4
,
...
props
},
ref
)
=>
(
<
PopoverPrimitive
.
Portal
>
<
PopoverPrimitive
.
Content
ref
=
{
ref
}
...
...
This diff is collapsed.
Click to expand it.
src/components/plate-ui/table-element.tsx
+
37
−
28
View file @
7268e5f1
...
...
@@ -205,38 +205,47 @@ export const TableElement = withHOC(
const
{
colSizes
,
isSelectingCell
,
marginLeft
,
minColumnWidth
}
=
useTableElementState
();
const
{
colGroupProps
,
props
:
tableProps
}
=
useTableElement
();
return
(
<
TableFloatingToolbar
>
<
PlateElement
className
=
{
cn
(
className
,
'
overflow-x-auto
'
)
}
style
=
{
{
paddingLeft
:
marginLeft
}
}
{
...
props
}
>
<
table
ref
=
{
ref
}
className
=
{
cn
(
'
my-4 ml-px mr-0 table h-px w-[calc(100%-6px)] table-fixed border-collapse
'
,
isSelectingCell
&&
'
[&_*::selection]:!bg-transparent
'
)
}
{
...
tableProps
}
<
div
className
=
'relative'
>
<
TableFloatingToolbar
>
<
PlateElement
onClick
=
{
(
e
)
=>
{
const
x
=
e
.
clientX
const
y
=
e
.
clientY
console
.
log
(
x
,
y
)
}
}
className
=
{
cn
(
className
,
'
overflow-x-auto
'
)
}
style
=
{
{
paddingLeft
:
marginLeft
}
}
{
...
props
}
>
<
colgroup
{
...
colGroupProps
}
>
{
colSizes
.
map
((
width
,
index
)
=>
(
<
col
key
=
{
index
}
style
=
{
{
minWidth
:
minColumnWidth
,
width
:
width
||
undefined
,
}
}
/>
))
}
</
colgroup
>
<
table
ref
=
{
ref
}
className
=
{
cn
(
'
my-4 ml-px mr-0 table h-px w-[calc(100%-6px)] table-fixed border-collapse
'
,
isSelectingCell
&&
'
[&_*::selection]:!bg-transparent
'
)
}
{
...
tableProps
}
>
<
colgroup
{
...
colGroupProps
}
>
{
colSizes
.
map
((
width
,
index
)
=>
(
<
col
key
=
{
index
}
style
=
{
{
minWidth
:
minColumnWidth
,
width
:
width
||
undefined
,
}
}
/>
))
}
</
colgroup
>
<
tbody
className
=
'min-w-full '
>
{
children
}
</
tbody
>
</
table
>
</
PlateElement
>
</
TableFloatingToolbar
>
<
tbody
className
=
'min-w-full'
>
{
children
}
</
tbody
>
</
table
>
</
PlateElement
>
</
TableFloatingToolbar
>
</
div
>
);
})
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment