Skip to content

Commit fda03e3

Browse files
shaurya-harnessHarness
authored andcommitted
fix: page header layout (#10855)
* 51ddfd fix: page header layout
1 parent ad2b69b commit fda03e3

2 files changed

Lines changed: 41 additions & 39 deletions

File tree

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@harnessio/ui",
33
"description": "Harness Canary UI component library",
4-
"version": "0.0.296",
4+
"version": "0.0.297",
55
"private": false,
66
"type": "module",
77
"main": "./dist/index.js",

packages/ui/src/views/components/page.tsx

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface PageHeaderProps {
3838
favoriteProps?: Omit<FavoriteIconProps, 'className'>
3939
isLoading?: boolean
4040
actions?: ReactNode
41+
headerActions?: ReactNode
4142
}
4243

4344
const Header: FC<PageHeaderProps> = ({
@@ -50,7 +51,8 @@ const Header: FC<PageHeaderProps> = ({
5051
children,
5152
favoriteProps,
5253
isLoading = false,
53-
actions
54+
actions,
55+
headerActions
5456
}) => {
5557
const titleElement =
5658
typeof title === 'string' ? (
@@ -62,44 +64,44 @@ const Header: FC<PageHeaderProps> = ({
6264
)
6365

6466
return (
65-
<Layout.Horizontal justify="between" gap="xl" className="mb-cn-md">
66-
<Layout.Vertical gap="md" className="w-full">
67-
<Layout.Vertical>
68-
{!!backLink && (
69-
<Link prefixIcon {...backLink.linkProps}>
70-
{backLink.linkText}
71-
</Link>
67+
<Layout.Vertical gap="sm" className="mb-cn-3xl w-full">
68+
<Layout.Horizontal>
69+
{!!backLink && (
70+
<Link prefixIcon {...backLink.linkProps}>
71+
{backLink.linkText}
72+
</Link>
73+
)}
74+
{!!headerActions && <ButtonLayout className="flex-1">{headerActions}</ButtonLayout>}
75+
</Layout.Horizontal>
76+
<Layout.Horizontal>
77+
<Layout.Grid gap="xs" flow="column">
78+
{isLoading ? (
79+
<>
80+
<Skeleton.Logo className="mt-cn-4xs" size="md" />
81+
<Skeleton.Typography className="w-80" variant="heading-section" />
82+
</>
83+
) : (
84+
<>
85+
{!!logoName && <LogoV2 className="mt-cn-4xs" name={logoName} size="md" />}
86+
{iconName ? (
87+
<Layout.Horizontal gap="xs" align="center">
88+
<div className="mt-cn-4xs">
89+
<IconV2 name={iconName} size={iconSize} />
90+
</div>
91+
{titleElement}
92+
</Layout.Horizontal>
93+
) : (
94+
titleElement
95+
)}
96+
</>
7297
)}
73-
<Layout.Grid gap="xs" flow="column">
74-
{isLoading ? (
75-
<>
76-
<Skeleton.Logo className="mt-cn-4xs" size="md" />
77-
<Skeleton.Typography className="w-80" variant="heading-section" />
78-
</>
79-
) : (
80-
<>
81-
{!!logoName && <LogoV2 className="mt-cn-4xs" name={logoName} size="md" />}
82-
{iconName ? (
83-
<Layout.Horizontal gap="xs" align="center">
84-
<div className="mt-cn-4xs">
85-
<IconV2 name={iconName} size={iconSize} />
86-
</div>
87-
{titleElement}
88-
</Layout.Horizontal>
89-
) : (
90-
titleElement
91-
)}
92-
</>
93-
)}
94-
{!!favoriteProps && !isLoading && <Favorite className="mt-cn-4xs" {...favoriteProps} />}
95-
</Layout.Grid>
96-
</Layout.Vertical>
97-
{!!description && <Text>{description}</Text>}
98-
{children}
99-
</Layout.Vertical>
100-
101-
{!!actions && <ButtonLayout className="self-end">{actions}</ButtonLayout>}
102-
</Layout.Horizontal>
98+
{!!favoriteProps && !isLoading && <Favorite className="mt-cn-4xs" {...favoriteProps} />}
99+
</Layout.Grid>
100+
{!!actions && <ButtonLayout className="flex-1">{actions}</ButtonLayout>}
101+
</Layout.Horizontal>
102+
{!!description && <Text>{description}</Text>}
103+
{children}
104+
</Layout.Vertical>
103105
)
104106
}
105107
Header.displayName = 'PageHeader'

0 commit comments

Comments
 (0)