-
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.
Browse files
Browse the repository at this point in the history
Feature/#8 layout
- Loading branch information
Showing
30 changed files
with
626 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<style> | ||
html, | ||
body, | ||
#storybook-root { | ||
height: 100%; | ||
margin: 0; | ||
} | ||
</style> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -67,6 +67,8 @@ | |
"rollup": "^4.9.2", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"sass": "^1.69.7", | ||
"sass-loader": "^13.3.3", | ||
"storybook": "^7.6.7", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.3.3" | ||
|
@@ -79,5 +81,8 @@ | |
"*.{css,js,jsx,ts,tsx,md}": "npm run lint:fix" | ||
}, | ||
"readme": "ERROR: No README data found!", | ||
"_id": "[email protected]" | ||
"_id": "[email protected]", | ||
"dependencies": { | ||
"clsx": "^2.1.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
// Auto-generated file. Do not modify manually. | ||
export * from "./layout"; | ||
export * from "./logo"; | ||
export * from "./page"; |
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 '../../../settings/style'; | ||
|
||
.mykn-column { | ||
grid-column: auto / 6 span; | ||
} | ||
|
||
.mykn-column--debug { | ||
outline: 1px solid blue; | ||
} | ||
|
||
.mykn-column--debug:before { | ||
color: blue; | ||
content: "Mobile (full span)"; | ||
display: block; | ||
font-family: monospace; | ||
text-align: center; | ||
} | ||
|
||
.mykn-column--debug[data-testid]:before { | ||
content: attr(data-testid)!important; | ||
} | ||
|
||
@media screen and (min-width: $breakpoint-desktop) { | ||
@for $i from 1 through 12 { | ||
.mykn-column--span-#{$i} { | ||
grid-column: auto / span #{$i}; | ||
} | ||
|
||
.mykn-column--debug.mykn-column--span-#{$i}:before { | ||
content: "Span #{$i}"; | ||
} | ||
} | ||
} | ||
|
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,42 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
|
||
import { Container } from "../container"; | ||
import { Grid } from "../grid"; | ||
import { Column } from "./column"; | ||
|
||
const meta = { | ||
title: "Layout/Column", | ||
component: Column, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
render: (args) => ( | ||
<Container debug={args.debug} data-testid="Container"> | ||
<Grid debug={args.debug} data-testid="Grid"> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
<Column {...args}></Column> | ||
</Grid> | ||
</Container> | ||
), | ||
} satisfies Meta<typeof Column>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const ColumnComponent: Story = { | ||
args: { | ||
debug: true, | ||
span: 1, | ||
}, | ||
}; |
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,40 @@ | ||
import clsx from "clsx"; | ||
import React from "react"; | ||
|
||
import "./column.scss"; | ||
|
||
export type ColumnProps = React.PropsWithChildren<{ | ||
span: number; | ||
|
||
/** If set, show the outline of the column. */ | ||
debug?: boolean; | ||
|
||
/** Gets passed as props. */ | ||
[index: string]: unknown; | ||
}>; | ||
|
||
/** | ||
* Column component, must be placed within a Grid component. | ||
* @param children | ||
* @param debug | ||
* @param span | ||
* @param props | ||
* @constructor | ||
*/ | ||
export const Column: React.FC<ColumnProps> = ({ | ||
children, | ||
debug, | ||
span, | ||
...props | ||
}) => { | ||
return ( | ||
<div | ||
className={clsx("mykn-column", `mykn-column--span-${span}`, { | ||
"mykn-column--debug": debug, | ||
})} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; |
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 @@ | ||
export * from "./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,21 @@ | ||
.mykn-container { | ||
margin: 0 auto; | ||
max-width: 1240px; | ||
width: 100%; | ||
} | ||
|
||
.mykn-container--debug { | ||
outline: 1px solid red; | ||
} | ||
|
||
.mykn-container--debug[data-testid]:before { | ||
content: attr(data-testid); | ||
color: red; | ||
display: block; | ||
font-family: monospace; | ||
text-align: center; | ||
} | ||
|
||
.mykn-container--debug[data-testid]:before { | ||
content: attr(data-testid); | ||
} |
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,21 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { Container } from "./container"; | ||
|
||
const meta = { | ||
title: "Layout/Container", | ||
component: Container, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
} satisfies Meta<typeof Container>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const ContainerComponent: Story = { | ||
args: { | ||
"data-testid": "Container", | ||
debug: true, | ||
}, | ||
}; |
Oops, something went wrong.