Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: columns #1008

Merged
merged 3 commits into from
Nov 5, 2024
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
20 changes: 20 additions & 0 deletions components/Columns/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';

import './style.scss';

export const Column = ({ children }) => {
return (
<div className="Column">{children}</div>
)
}

const Columns = ({ children, columns = 2, layout = 'auto'}) => {
layout = layout === 'fixed' ? '1fr' : 'auto';
return (
<div className="Columns" style={{ gridTemplateColumns: `repeat(${columns}, ${layout})` }}>
{children}
</div>
);
};

export default Columns;
4 changes: 4 additions & 0 deletions components/Columns/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Columns {
display: grid;
gap: var(--md, 20px);
}
1 change: 1 addition & 0 deletions components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export { default as Callout } from './Callout';
export { default as Cards, Card } from './Cards';
export { default as Code } from './Code';
export { default as CodeTabs } from './CodeTabs';
export { default as Columns, Column } from './Columns';
export { default as Embed } from './Embed';
export { default as Glossary } from './Glossary';
export { default as HTMLBlock } from './HTMLBlock';
Expand Down
16 changes: 16 additions & 0 deletions docs/built-in-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,19 @@
<Tab title="Second Tab">Here's content that's only inside the second Tab.</Tab>
<Tab title="Third Tab">Here's content that's only inside the third Tab.</Tab>
</Tabs>

---

### Columns

<Columns columns={3} layout="auto">
<Column>
Neque porro quisquam est qui dolorem ipsum quia
</Column>
<Column>
*Lorem ipsum dolor sit amet, consectetur adipiscing elit*
</Column>
<Column>
> Ut enim ad minim veniam, quis nostrud ullamco
</Column>
</Columns>