Skip to content

Commit

Permalink
chore(react): resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
savindi7 committed Feb 16, 2023
2 parents e8bb8ab + bf108dc commit e95ffeb
Show file tree
Hide file tree
Showing 51 changed files with 1,266 additions and 66 deletions.
53 changes: 39 additions & 14 deletions packages/react/.storybook/story-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,22 @@ export type Stories =
| 'ActionCard'
| 'AppBar'
| 'Avatar'
| 'Badge'
| 'Box'
| 'Button'
| 'CircularProgress'
| 'Card'
| 'CardActions'
| 'CardContent'
| 'CardHeader'
| 'CircularProgressAvatar'
| 'Chip'
| 'ColorModeToggle'
| 'Colors'
| 'Container'
| 'Divider'
| 'Drawer'
| 'Footer'
| 'Grid'
| 'Header'
| 'IconButton'
Expand All @@ -67,6 +73,7 @@ export type Stories =
| 'Tooltip'
| 'Typeset'
| 'Typography'
| 'UserDropdownMenu'
| 'Welcome';
export type StorybookConfig = Record<
Stories,
Expand All @@ -88,17 +95,6 @@ export type StorybookConfig = Record<
>;

const StoryConfig: StorybookConfig = {
Header: {
story: {
Overview: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/HyEVOfDBGyXsvPSbNdgquW/Navigation%2FHeader?node-id=120%3A1437&t=NT0uoPAY3qLFlkmN-0',
},
},
},
hierarchy: `${StorybookCategories.Navigation}/Header`,
},
ActionCard: {
hierarchy: `${StorybookCategories.Surfaces}/Action Card`,
},
Expand All @@ -108,6 +104,9 @@ const StoryConfig: StorybookConfig = {
Avatar: {
hierarchy: `${StorybookCategories.DataDisplay}/Avatar`,
},
Badge: {
hierarchy: `${StorybookCategories.DataDisplay}/Badge`,
},
Box: {
hierarchy: `${StorybookCategories.Layout}/Box`,
},
Expand All @@ -117,12 +116,21 @@ const StoryConfig: StorybookConfig = {
CircularProgress: {
hierarchy: `${StorybookCategories.Feedback}/Circular Progress`,
},
Card: {
hierarchy: `${StorybookCategories.Surfaces}/Card`,
},
CardActions: {
hierarchy: `${StorybookCategories.Surfaces}/CardActions`,
},
CardContent: {
hierarchy: `${StorybookCategories.Surfaces}/CardContent`,
},
CardHeader: {
hierarchy: `${StorybookCategories.Surfaces}/CardHeader`,
},
CircularProgressAvatar: {
hierarchy: `${StorybookCategories.DataDisplay}/Circular Progress Avatar`,
},
UserDropdownMenu: {
hierarchy: `${StorybookCategories.Navigation}/User Dropdown Menu`,
},
Chip: {
hierarchy: `${StorybookCategories.DataDisplay}/Chip`,
},
Expand All @@ -141,9 +149,23 @@ const StoryConfig: StorybookConfig = {
Drawer: {
hierarchy: `${StorybookCategories.Navigation}/Drawer`,
},
Footer: {
hierarchy: `${StorybookCategories.Navigation}/Footer`,
},
Grid: {
hierarchy: `${StorybookCategories.Layout}/Grid`,
},
Header: {
story: {
Overview: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/HyEVOfDBGyXsvPSbNdgquW/Navigation%2FHeader?node-id=120%3A1437&t=NT0uoPAY3qLFlkmN-0',
},
},
},
hierarchy: `${StorybookCategories.Navigation}/Header`,
},
Image: {
hierarchy: `${StorybookCategories.DataDisplay}/Image`,
},
Expand Down Expand Up @@ -201,6 +223,9 @@ const StoryConfig: StorybookConfig = {
Typography: {
hierarchy: `${StorybookCategories.DataDisplay}/Typography`,
},
UserDropdownMenu: {
hierarchy: `${StorybookCategories.Navigation}/User Dropdown Menu`,
},
Welcome: {
hierarchy: 'Welcome',
},
Expand Down
12 changes: 4 additions & 8 deletions packages/react/src/components/ActionCard/ActionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import Card, {CardProps} from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import {FC, ReactElement, ReactNode} from 'react';
import clsx from 'clsx';
import {FC, ReactElement, ReactNode} from 'react';
import Button from '../Button';
import Typography from '../Typography';
import {WithWrapperProps} from '../../models';
Expand Down Expand Up @@ -57,15 +57,11 @@ const ActionCard: FC<ActionCardProps> & WithWrapperProps = (props: ActionCardPro
const classes: string = clsx('oxygen-action-card', className);

return (
<Card className={classes} {...rest}>
<Card className={classes} {...rest} elevation={1}>
<CardContent>
{image}
<Typography variant="subtitle2" className="title">
{title}
</Typography>
<Typography variant="body1" color="secondary.main" className="description">
{description}
</Typography>
<Typography variant="subtitle2">{title}</Typography>
<Typography variant="body1">{description}</Typography>
</CardContent>
<CardActions>
<Button onClick={onActionClick} variant="contained">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`ActionCard should match the snapshot 1`] = `
<body>
<div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root oxygen-action-card css-2in4ew-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root oxygen-action-card css-1sjg1d0-MuiPaper-root-MuiCard-root"
>
<div
class="MuiCardContent-root css-46bh2p-MuiCardContent-root"
Expand All @@ -14,12 +14,12 @@ exports[`ActionCard should match the snapshot 1`] = `
src="/assets/images/action-card-image.svg"
/>
<h6
class="MuiTypography-root MuiTypography-subtitle2 oxygen-typography title css-n98czh-MuiTypography-root"
class="MuiTypography-root MuiTypography-subtitle2 oxygen-typography css-no3yss-MuiTypography-root"
>
Secure your account by adding an extra layer of security
</h6>
<p
class="MuiTypography-root MuiTypography-body1 oxygen-typography description css-167a66v-MuiTypography-root"
class="MuiTypography-root MuiTypography-body1 oxygen-typography css-1myvrax-MuiTypography-root"
>
Configure additional authentications to sign in easily or to add an extra layer of security to your account.
</p>
Expand Down
22 changes: 1 addition & 21 deletions packages/react/src/components/ActionCard/action-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,7 @@
*/

.oxygen-action-card {
border-radius: 8px;
box-shadow: 0 2px 20px 0 #1d20281a;
padding: 24px 40px 24px 24px;

&:hover {
border: 1px solid #ff7300;
}

.title {
color: #222228;
font-size: 15px;
font-style: normal;
font-weight: 400;
line-height: 24px;
}

.description {
color: "#8D91A3";
font-size: 13px;
font-style: normal;
font-weight: 400;
line-height: 20px;
border: 1px solid var(--oxygen-palette-primary-main);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`AppBar should match the snapshot 1`] = `
<body>
<div>
<header
class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation4 MuiAppBar-root MuiAppBar-colorPrimary MuiAppBar-positionFixed oxygen-app-bar mui-fixed css-vfrfmn-MuiPaper-root-MuiAppBar-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation4 MuiAppBar-root MuiAppBar-colorPrimary MuiAppBar-positionFixed oxygen-app-bar mui-fixed css-ifmgpx-MuiPaper-root-MuiAppBar-root"
/>
</div>
</body>
Expand Down
45 changes: 45 additions & 0 deletions packages/react/src/components/Badge/Badge.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {ArgsTable, Source, Story, Canvas, Meta} from '@storybook/addon-docs';
import dedent from 'ts-dedent';
import StoryConfig from '../../../.storybook/story-config.ts';
import {withDesign} from '../../../.storybook/utils.ts';
import Badge from './Badge.tsx';

export const meta = {
component: Badge,
title: StoryConfig.Badge.hierarchy,
};

<Meta title={meta.title} component={meta.component} />

export const Template = args => <Badge {...args} />;

# Badge

- [Overview](#overview)
- [Props](#props)
- [Usage](#usage)

## Overview

Generate a badge for elements.

<Canvas>
<Story name="Overview" args={{badgeContent:1, color:"primary", children: 'Element'}}>
{Template.bind({})}
</Story>
</Canvas>

## Props

<ArgsTable story="Overview" />

## Usage

Import and use the `Badge` component in your components as follows.

<Source
language="jsx"
dark
format
code={dedent`import Badge from '@oxygen-ui/react/Badge';\n`}
/>
41 changes: 41 additions & 0 deletions packages/react/src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import MuiBadge, {BadgeProps as MuiBadgeProps} from '@mui/material/Badge';
import clsx from 'clsx';
import {FC, ReactElement} from 'react';
import {WithWrapperProps} from '../../models';
import {composeComponentDisplayName} from '../../utils';
import './badge.scss';

export type BadgeProps = MuiBadgeProps;

const COMPONENT_NAME: string = 'Badge';

const Badge: FC<BadgeProps> & WithWrapperProps = (props: BadgeProps): ReactElement => {
const {className, ...rest} = props;

const classes: string = clsx('oxygen-badge', className);

return <MuiBadge className={classes} {...rest} />;
};

Badge.displayName = composeComponentDisplayName(COMPONENT_NAME);
Badge.muiName = COMPONENT_NAME;

export default Badge;
32 changes: 32 additions & 0 deletions packages/react/src/components/Badge/__tests__/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import {render} from '@unit-testing';
import Badge from '../Badge';

describe('Badge', () => {
it('should render successfully', () => {
const {baseElement} = render(<Badge />);
expect(baseElement).toBeTruthy();
});

it('should match the snapshot', () => {
const {baseElement} = render(<Badge />);
expect(baseElement).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Badge should match the snapshot 1`] = `
<body>
<div>
<span
class="MuiBadge-root oxygen-badge MuiBadge-root css-1c32n2y-MuiBadge-root"
>
<span
class="MuiBadge-badge MuiBadge-standard MuiBadge-invisible MuiBadge-anchorOriginTopRight MuiBadge-anchorOriginTopRightRectangular MuiBadge-overlapRectangular MuiBadge-badge css-uh1ep6-MuiBadge-badge"
/>
</span>
</div>
</body>
`;
21 changes: 21 additions & 0 deletions packages/react/src/components/Badge/badge.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

.oxygen-badge {
/** Add Styles */
}
20 changes: 20 additions & 0 deletions packages/react/src/components/Badge/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export {default} from './Badge';
export type {BadgeProps} from './Badge';
Loading

0 comments on commit e95ffeb

Please sign in to comment.