@xqmsg/ui-core 0.16.4 → 0.16.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.16.4",
2
+ "version": "0.16.6",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,32 +1,29 @@
1
1
  import React from 'react';
2
- import { Button, Text, Icon } from '@chakra-ui/react';
3
- import GoogleLogo from './assets/GoogleLogo.svg';
2
+ import { Button, ButtonProps } from '..';
3
+ import { ReactComponent as GoogleLogo } from './assets/GoogleLogo.svg';
4
4
 
5
- export interface GoogleButtonProps {
5
+ export interface GoogleButtonProps extends Partial<ButtonProps> {
6
6
  onClick: () => void;
7
7
  }
8
8
 
9
9
  /**
10
10
  * A functional React component utilized to render the `GoogleButton` component
11
11
  */
12
- export const GoogleButton: React.FC<GoogleButtonProps> = ({ onClick }) => {
12
+ export const GoogleButton: React.FC<GoogleButtonProps> = ({
13
+ onClick,
14
+ type,
15
+ }) => {
13
16
  return (
14
17
  <Button
15
18
  onClick={onClick}
16
- variant="plain"
17
- size="lg"
18
- borderRadius="2px"
19
- aria-label="google-login-button"
19
+ variant="secondary"
20
+ ariaLabel="google-login-button"
20
21
  className="google-button"
21
- px={4}
22
- leftIcon={<Icon as={GoogleLogo} width={18} height={18} mr={3} />}
23
- fontFamily="Roboto, sans-serif"
24
- fontWeight="500"
25
- fontSize={14}
26
- backgroundColor="white"
27
- boxShadow="rgba(0, 0, 0, 0.24) 0px 0px 1px 0px, rgba(0, 0, 0, 0.24) 0px 2px 2px 0px"
28
- >
29
- <Text color="rgba(0, 0, 0, 0.54)">{'Sign in with Google'}</Text>
30
- </Button>
22
+ leftIcon={<GoogleLogo width={18} height={18} mr={3} />}
23
+ text="Sign in with Google"
24
+ width="variable"
25
+ type={type}
26
+ color="#000"
27
+ />
31
28
  );
32
29
  };
@@ -11,6 +11,9 @@ export interface ButtonProps {
11
11
  ariaLabel: string;
12
12
  disabled?: boolean;
13
13
  className?: string;
14
+ leftIcon?: JSX.Element;
15
+ rightIcon?: JSX.Element;
16
+ color?: string;
14
17
  }
15
18
 
16
19
  /**
@@ -25,6 +28,9 @@ export const Button: React.FC<ButtonProps> = ({
25
28
  disabled,
26
29
  className,
27
30
  width,
31
+ rightIcon,
32
+ leftIcon,
33
+ color,
28
34
  }) => {
29
35
  return (
30
36
  <ChakraButton
@@ -35,6 +41,9 @@ export const Button: React.FC<ButtonProps> = ({
35
41
  aria-label={ariaLabel}
36
42
  className={className}
37
43
  width={width === 'fixed' ? '100%' : 'fit-content'}
44
+ rightIcon={rightIcon}
45
+ leftIcon={leftIcon}
46
+ color={color}
38
47
  >
39
48
  {text}
40
49
  </ChakraButton>
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { Meta, Story } from '@storybook/react';
3
+ import { MicrosoftButton, MicrosoftButtonProps } from '.';
4
+
5
+ const meta: Meta<MicrosoftButtonProps> = {
6
+ title: 'Microsoft Button example',
7
+ component: MicrosoftButton,
8
+ argTypes: {
9
+ onClick: {
10
+ description: 'The onClick callback for the google button',
11
+ },
12
+ },
13
+ parameters: {
14
+ controls: { expanded: true },
15
+ },
16
+ };
17
+ export default meta;
18
+ const Template: Story<MicrosoftButtonProps> = args => (
19
+ <MicrosoftButton {...args} />
20
+ );
21
+
22
+ export const Default = Template.bind({});
23
+ Default.args = {
24
+ onClick: () => alert('This is a google button click!'),
25
+ };