Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@eqtylab/equality",
"description": "EQTYLab's component and token-based design system",
"homepage": "https://equality.eqtylab.io/",
"version": "1.1.8",
"version": "1.1.9",
"license": "Apache-2.0",
"keywords": [
"component library",
Expand Down
8 changes: 7 additions & 1 deletion packages/ui/src/components/dialog/dialog.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@
}

.dialog-header {
@apply flex shrink-0 items-start justify-between gap-4;
@apply flex shrink-0 items-center gap-4;
@apply text-left;
@apply border-b-1 border-border;
@apply px-6 py-3;
}

.dialog-header-icon {
@apply shrink-0;
@apply flex items-center justify-center;
}

.dialog-header-content {
@apply flex min-w-0 flex-1 flex-col;
@apply space-y-0.5;
}

.dialog-title {
Expand Down
31 changes: 24 additions & 7 deletions packages/ui/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,30 @@ const DialogContainer = React.forwardRef<
));
DialogContainer.displayName = DialogPrimitive.Content.displayName;

const DialogHeader = ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div className={cn(styles['dialog-header'], className)} {...props}>
<div className={styles['dialog-header-content']}>{children}</div>
<DialogPrimitive.Close asChild>
<IconButton name="X" label="Close" size="sm" />
</DialogPrimitive.Close>
</div>
const DialogHeaderIcon = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div className={cn(styles['dialog-header-icon'], className)} {...props} />
);
DialogHeaderIcon.displayName = 'DialogHeaderIcon';

const DialogHeader = ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
const childrenArray = React.Children.toArray(children);
const icon = childrenArray.find(
(child) => React.isValidElement(child) && child.type === DialogHeaderIcon
);
const otherChildren = childrenArray.filter(
(child) => !(React.isValidElement(child) && child.type === DialogHeaderIcon)
);

return (
<div className={cn(styles['dialog-header'], className)} {...props}>
{icon}
<div className={styles['dialog-header-content']}>{otherChildren}</div>
<DialogPrimitive.Close asChild>
<IconButton name="X" label="Close" size="sm" />
</DialogPrimitive.Close>
</div>
);
};
DialogHeader.displayName = 'DialogHeader';

const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
Expand Down Expand Up @@ -100,6 +116,7 @@ export {
DialogDescription,
DialogFooter,
DialogHeader,
DialogHeaderIcon,
DialogOverlay,
DialogPortal,
DialogTitle,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/sheet/sheet.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

.sheet-header-text-content {
@apply flex min-w-0 flex-1 flex-col;
@apply space-y-2;
@apply space-y-0.5;
}

.sheet-body {
Expand Down