Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #75 from smartive-education/feature/container
Browse files Browse the repository at this point in the history
  • Loading branch information
tomschall authored Jan 7, 2023
2 parents b031059 + 0994db3 commit 40de755
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import styled from 'styled-components';
import tw from 'twin.macro';

export interface IContainerProps {
children?: React.ReactNode;
layout: 'plain' | 'box';
}

export const Container: React.FC<IContainerProps> = (props: IContainerProps) => {
const { layout = 'colored', children } = props;

return <SectionWrapper layout={layout}>{children}</SectionWrapper>;
};

interface ContainerStyles {
layout: string;
}

const SectionWrapper = styled.section(({ layout }: ContainerStyles) => [
tw`
container
mx-4
sm:mx-auto
`,
layout === 'box' && tw`bg-slate-white rounded-lg py-8 mx-4`,
layout === 'plain' && tw`bg-none px-4 bg-violet-400`,
]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled from 'styled-components';
import tw from 'twin.macro';
import { MumbleLogo, IMumbleLogoProps } from './branding/MumbleLogo';
import { NaviButton, INaviButtonProps } from './buttons/NaviButton';

export interface INavigationProps {
logo: IMumbleLogoProps;
avatar: INaviButtonProps;
Expand Down Expand Up @@ -45,34 +44,40 @@ export const Navigation: React.FC<INavigationProps> = ({
}) => {
return (
<>
<NavigationStyles>
<Container>
<Column>
<MumbleLogo
title={logo.title}
href={logo.href}
variant="white"
alignment="horizontal"
fCallBack={logo.fCallBack}
isNavigation={true}
/>
<Row>
<NaviButton variant={avatar.variant} label={avatar.label} fCallBack={avatar.fCallBack} src={avatar.src} />
<NaviButton
icon={settings.icon}
label={settings.label}
variant={settings.variant}
fCallBack={settings.fCallBack}
<HeaderStyles>
<NavigationStyles>
<Container>
<Column>
<MumbleLogo
title={logo.title}
href={logo.href}
variant="white"
alignment="horizontal"
fCallBack={logo.fCallBack}
isNavigation={true}
/>
<NaviButton icon={logout.icon} label={logout.label} variant={logout.variant} fCallBack={logout.fCallBack} />
</Row>
</Column>
</Container>
</NavigationStyles>
<Row>
<NaviButton variant={avatar.variant} label={avatar.label} fCallBack={avatar.fCallBack} src={avatar.src} />
<NaviButton
icon={settings.icon}
label={settings.label}
variant={settings.variant}
fCallBack={settings.fCallBack}
/>
<NaviButton icon={logout.icon} label={logout.label} variant={logout.variant} fCallBack={logout.fCallBack} />
</Row>
</Column>
</Container>
</NavigationStyles>
</HeaderStyles>
</>
);
};

const HeaderStyles = tw.header`
w-full
`;

const Container = tw.div`
flex
flex-col
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import { Container } from '../components/Container';

export default {
title: 'Wireframes/Container',
component: Container,
argTypes: {
layout: {
control: 'select',
table: {
defaultValue: {
summary: 'plain',
},
},
},
},
args: {
layout: 'box',
},
} as ComponentMeta<typeof Container>;

const Template: ComponentStory<typeof Container> = (args) => <Container {...args} />;

export const ContainerStory = Template.bind({});

ContainerStory.storyName = 'Container';

0 comments on commit 40de755

Please sign in to comment.