-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from troychaplin/feature/column
Feature/column
- Loading branch information
Showing
7 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import { Column } from '.' | ||
|
||
const meta = { | ||
title: 'Layouts/Column', | ||
component: Column, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof Column> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Primary: Story = { | ||
render: (args) => ( | ||
<Column {...args}> | ||
<Column.Content> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus gravida orci elit, at consectetur lectus | ||
iaculis vel. Cras non fringilla velit, a posuere felis. Mauris faucibus dui ultricies ultrices luctus. Aliquam | ||
erat volutpat. Vestibulum imperdiet, enim non elementum pulvinar, lacus quam vestibulum eros, ut eleifend sem | ||
dui ut quam. | ||
</p> | ||
</Column.Content> | ||
<Column.Content> | ||
<p> | ||
Nam facilisis pulvinar ligula nec cursus. Mauris ut tempor enim. Nullam sodales eros ut velit ullamcorper | ||
fringilla. Fusce a sem est. Vivamus eleifend accumsan pellentesque. Pellentesque in ante urna. Nullam finibus | ||
sed nunc ac volutpat. Maecenas lacinia justo a arcu tempor, ac tempor magna faucibus. | ||
</p> | ||
</Column.Content> | ||
</Column> | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
export interface ColumnContentProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export const ColumnContent = ({ children }: ColumnContentProps) => { | ||
return <div>{children}</div> | ||
} | ||
|
||
ColumnContent.displayName = 'Column.Content' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { gridColumns } from '../../utils/tailwindProps' | ||
import { ColumnContent } from './content' | ||
|
||
type ColumnKeys = keyof typeof gridColumns | ||
|
||
interface ColumnProps { | ||
children?: React.ReactNode | ||
cols?: ColumnKeys | ||
gap?: number | ||
} | ||
|
||
export const ColumnContainer = ({ children, cols = 2, gap = 30 }: ColumnProps) => { | ||
// Inline style object to handle grid gap | ||
const style = { | ||
gridGap: gap ? gap : '', | ||
} | ||
|
||
return ( | ||
<div className={`ui-column grid ${gridColumns[cols]}`} style={style}> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
export const Column = Object.assign(ColumnContainer, { | ||
Content: ColumnContent, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters