@dtdot/lego 0.18.5 → 0.18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface ButtonGroupProps {
3
+ alignment?: 'left' | 'right';
3
4
  children: React.ReactNode;
4
5
  }
5
- declare const ButtonGroup: ({ children }: ButtonGroupProps) => JSX.Element;
6
+ declare const ButtonGroup: ({ children, alignment }: ButtonGroupProps) => JSX.Element;
6
7
  export default ButtonGroup;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  const ButtonGroupDiv = styled.div `
4
4
  display: flex;
5
+ justify-content: ${(props) => (props.alignment === 'left' ? 'flex-start' : 'flex-end')};
5
6
 
6
7
  & > * {
7
8
  margin-right: 8px;
@@ -11,7 +12,7 @@ const ButtonGroupDiv = styled.div `
11
12
  }
12
13
  }
13
14
  `;
14
- const ButtonGroup = ({ children }) => {
15
- return React.createElement(ButtonGroupDiv, null, children);
15
+ const ButtonGroup = ({ children, alignment = 'left' }) => {
16
+ return React.createElement(ButtonGroupDiv, { alignment: alignment }, children);
16
17
  };
17
18
  export default ButtonGroup;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Meta } from '@storybook/react/types-6-0';
3
3
  export declare const Standard: () => JSX.Element;
4
+ export declare const RightAligned: () => JSX.Element;
4
5
  export declare const TwoPrimary: () => JSX.Element;
5
6
  export declare const SquareButtons: () => JSX.Element;
6
7
  declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
@@ -4,6 +4,9 @@ import { ButtonGroup, Button, SquareButton } from '../..';
4
4
  export const Standard = () => (React.createElement(ButtonGroup, null,
5
5
  React.createElement(Button, { variant: 'secondary' }, "Cancel"),
6
6
  React.createElement(Button, null, "Create")));
7
+ export const RightAligned = () => (React.createElement(ButtonGroup, { alignment: 'right' },
8
+ React.createElement(Button, { variant: 'secondary' }, "Cancel"),
9
+ React.createElement(Button, null, "Create")));
7
10
  export const TwoPrimary = () => (React.createElement(ButtonGroup, null,
8
11
  React.createElement(Button, null, "No"),
9
12
  React.createElement(Button, null, "Yes")));
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dtdot/lego",
3
- "version": "0.18.5",
3
+ "version": "0.18.6",
4
4
  "description": "Some reusable components for building my applications",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
7
7
  "build": "tsc",
8
- "start": "start-storybook -p 6006",
8
+ "start": "start-storybook -p 6006 --no-open",
9
9
  "watch": "npm run build -- --watch",
10
10
  "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
11
11
  "storybook": "start-storybook -p 6006",