Skip to content

Commit

Permalink
Merge pull request #86 from code0-tech/flex-container
Browse files Browse the repository at this point in the history
Simple Flex component
  • Loading branch information
nicosammito authored May 3, 2024
2 parents 3f3431e + 562f666 commit 50f062e
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 1 deletion.
Binary file added __snapshots__/flex--example-flex-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __snapshots__/flex--example-flex-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __snapshots__/flex--example-flex-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@code0-tech/pictor",
"version": "0.2.2",
"version": "0.2.3",
"description": "A simple template for a custom React component library",
"scripts": {
"dev": "npm run storybook:dev",
Expand Down
20 changes: 20 additions & 0 deletions src/components/flex/Flex.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Meta} from "@storybook/react";
import React from "react";
import Flex from "./Flex";
import Text from "../Text/Text";

const meta: Meta = {
title: "Flex",
component: Flex
}

export default meta

export const ExampleFlex = () => {

return <Flex>
<Text size={"md"} mr={1}>Example Text 1</Text>
<Text size={"md"}>Example Text 2</Text>
</Flex>

}
3 changes: 3 additions & 0 deletions src/components/flex/Flex.style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.flex {
display: flex;
}
20 changes: 20 additions & 0 deletions src/components/flex/Flex.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Code0Component} from "../../utils/types";
import React from "react";
import {mergeCode0Props} from "../../utils/utils";
import "./Flex.style.scss";

interface FlexType extends Code0Component<HTMLDivElement> {
children: React.ReactNode | React.ReactNode[]
}

const Flex: React.FC<FlexType> = props => {

const {children, ...rest} = props

return <div {...mergeCode0Props("flex", rest)}>
{children}
</div>

}

export default Flex
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export { default as Popover} from "./components/popover/Popover"
export { default as Quote} from "./components/quote/Quote"
export { default as Row} from "./components/row/Row"
export { default as Tooltip} from "./components/tooltip/Tooltip"
export { default as Flex} from "./components/flex/Flex"

0 comments on commit 50f062e

Please sign in to comment.