Skip to content

Commit

Permalink
✨ - feat: add support for vertical alignment in page component
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Feb 19, 2024
1 parent e7fb5be commit 45879b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/components/page/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
background-color: var(--page-color-background);
container-name: page;
container-type: inline-size;
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: var(--spacing-h-xl);
width: 100%;
min-height: 100%;

&--valign-middle {
justify-content: center;
}

@media screen and (min-width: constants.$breakpoint-desktop) {
padding: var(--spacing-v-xl) var(--spacing-h-xl);
}
Expand Down
14 changes: 11 additions & 3 deletions src/components/page/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import clsx from "clsx";
import React from "react";

import "./page.scss";

export type PageProps = React.PropsWithChildren<{
// Props here.
/** Vertical alignment of page content. */
valign?: "start" | "middle";
}>;

/**
* Provides the base theme for a page.
* @param children
* @param valign
* @param props
* @constructor
*/
export const Page: React.FC<PageProps> = ({ children, ...props }) => (
<div className="mykn-page" {...props}>
export const Page: React.FC<PageProps> = ({ children, valign, ...props }) => (
<div
className={clsx("mykn-page", {
[`mykn-page--valign-${valign}`]: valign,
})}
{...props}
>
{children}
</div>
);

0 comments on commit 45879b4

Please sign in to comment.