Skip to content

Commit 1a3625a

Browse files
authored
feat: columns (#1008)
[![PR App][icn]][demo] | Fix RM-11030 :-------------------:|:----------: ## 🧰 Changes - Implement `Columns` component <img width="500" alt="image" src="https://github.com/user-attachments/assets/eba81b86-f6c4-4791-ae91-ae0b757083d1"> <img width="500" alt="image" src="https://github.com/user-attachments/assets/b6b12f72-f490-4bd0-9624-7a3fc4a2d74d"> ## 🧬 QA & Testing - [Broken on production][prod]. - [Working in this PR app][demo]. [demo]: https://markdown-pr-PR_NUMBER.herokuapp.com [prod]: https://SUBDOMAIN.readme.io [icn]: https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg
1 parent 97a7ae7 commit 1a3625a

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

components/Columns/index.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
3+
import './style.scss';
4+
5+
export const Column = ({ children }) => {
6+
return (
7+
<div className="Column">{children}</div>
8+
)
9+
}
10+
11+
const Columns = ({ children, columns = 2, layout = 'auto'}) => {
12+
layout = layout === 'fixed' ? '1fr' : 'auto';
13+
return (
14+
<div className="Columns" style={{ gridTemplateColumns: `repeat(${columns}, ${layout})` }}>
15+
{children}
16+
</div>
17+
);
18+
};
19+
20+
export default Columns;

components/Columns/style.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.Columns {
2+
display: grid;
3+
gap: var(--md, 20px);
4+
}

components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export { default as Callout } from './Callout';
44
export { default as Cards, Card } from './Cards';
55
export { default as Code } from './Code';
66
export { default as CodeTabs } from './CodeTabs';
7+
export { default as Columns, Column } from './Columns';
78
export { default as Embed } from './Embed';
89
export { default as Glossary } from './Glossary';
910
export { default as HTMLBlock } from './HTMLBlock';

docs/built-in-components.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,19 @@
3535
<Tab title="Second Tab">Here's content that's only inside the second Tab.</Tab>
3636
<Tab title="Third Tab">Here's content that's only inside the third Tab.</Tab>
3737
</Tabs>
38+
39+
---
40+
41+
### Columns
42+
43+
<Columns columns={3} layout="auto">
44+
<Column>
45+
Neque porro quisquam est qui dolorem ipsum quia
46+
</Column>
47+
<Column>
48+
*Lorem ipsum dolor sit amet, consectetur adipiscing elit*
49+
</Column>
50+
<Column>
51+
> Ut enim ad minim veniam, quis nostrud ullamco
52+
</Column>
53+
</Columns>

0 commit comments

Comments
 (0)