Skip to content

Commit

Permalink
feat: add wrapper for react router dom
Browse files Browse the repository at this point in the history
  • Loading branch information
yadurani committed Dec 13, 2021
1 parent d8eeae9 commit 545714e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
24 changes: 15 additions & 9 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ThemeProvider } from 'emotion-theming';
import { createTheme } from "@mui/material/styles";
import { createTheme } from '@mui/material/styles';

import { THEME } from '@master-c8/theme';
import { BrowserRouter } from 'react-router-dom';

const getHiredTheme = createTheme(THEME);

Expand All @@ -14,30 +15,35 @@ const getStyles = ({ __sb } = {}) => ({
flexWrap: 'wrap',
height: '100%',
gap: '10px 30px',
alignItems: 'center'
})
alignItems: 'center',
});

export const parameters = {
actions: {
argTypesRegex: "^on[A-Z].*"
actions: {
argTypesRegex: '^on[A-Z].*',
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
}
}
},
};

export const decorators = [
(Story) => (
<BrowserRouter>
<Story />
</BrowserRouter>
),
(Story) => (
<ThemeProvider theme={getHiredTheme}>
<Story/>
<Story />
</ThemeProvider>
),
(Story, { parameters }) => (
<div style={getStyles(parameters)}>
<Story />
</div>
),
];
];
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@master-c8/commons",
"version": "0.0.7",
"version": "0.0.8",
"private": false,
"description": "Platzi Master C8 commons",
"main": "./dist/index",
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { Logotype } from '@master-c8/commons';

import { HeaderContent, BtnGroup } from './Header.styles';

const Header = ({ onClickLogin, onClickSignup, isLogged, children }) => {
const Header = ({ onClickLogin, onClickSignup, isLogged, children, route }) => {
return (
<HeaderContent>
<Container>
<Link>
<Link to={route}>
<Logotype width={140} />
</Link>
{!isLogged && (
Expand All @@ -36,11 +36,13 @@ Header.propTypes = {
isLogged: PropTypes.bool,
onClickLogin: PropTypes.func.isRequired,
onClickSignup: PropTypes.func.isRequired,
route: PropTypes.string,
};

Header.defaultProps = {
isLogged: false,
children: null,
route: '',
};

export default Header;

0 comments on commit 545714e

Please sign in to comment.