Skip to content

Commit

Permalink
feat: move exit button from header to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
schettn authored Sep 12, 2021
1 parent 26c83d3 commit d9d82a2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions packages/jaen-shared-ui/src/components/app/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
TabsMain,
LoginMain,
LoginMainProps,
HeaderMainProps
FooterMainProps
} from '@components/organisms/main'
import React, {useRef} from 'react'

Expand All @@ -30,7 +30,7 @@ export type MainProps = {
tabs: TabsMainProps
authenticated: boolean
login: LoginMainProps
header: HeaderMainProps
footer: FooterMainProps
}

const Main: React.FC<MainProps> = props => {
Expand All @@ -56,7 +56,7 @@ const Main: React.FC<MainProps> = props => {
{props.authenticated ? (
<>
<DrawerHeader>
<HeaderMain {...props.header} />
<HeaderMain />
</DrawerHeader>
<Divider />
<DrawerBody pd={0} mt={2}>
Expand All @@ -65,7 +65,7 @@ const Main: React.FC<MainProps> = props => {
</DrawerBody>
<Divider />
<DrawerFooter py={2}>
<FooterMain />
<FooterMain {...props.footer} />
</DrawerFooter>
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import {Story, Meta} from '@storybook/react'

import MainFooter from '.'
import MainFooter, {FooterMainProps} from '.'

export default {
title: 'Organisms/main/MainFooter',
component: MainFooter
} as Meta

const Template: Story = args => <MainFooter {...args} />
const Template: Story<FooterMainProps> = args => <MainFooter {...args} />

export const Primary = Template.bind({})

Primary.args = {}
Primary.args = {
onLogout: () => {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import {
VersionButton,
TooltipButton
} from '@components/molecules/buttons'
import ExitButton from '@src/components/molecules/buttons/ExitButton'
import React from 'react'

const MainFooter: React.FC = () => {
export interface FooterMainProps {
onLogout: () => void
}

const MainFooter: React.FC<FooterMainProps> = props => {
return (
<>
<HStack width="100%">
Expand All @@ -16,6 +21,7 @@ const MainFooter: React.FC = () => {
<TooltipButton />
<LanguageButton />
<VersionButton />
<ExitButton onClick={props.onLogout} />
</HStack>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ const Template: Story<HeaderMainProps> = args => <MainHeader {...args} />

export const Primary = Template.bind({})

Primary.args = {
onLogout: () => {}
}
Primary.args = {}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ import {
QuestionButton,
GithubButton
} from '@components/molecules/buttons'
import ExitButton from '@components/molecules/buttons/ExitButton'

export type HeaderMainProps = {
onLogout: () => void
}
export type HeaderMainProps = {}

const HeaderMain: React.FC<HeaderMainProps> = props => {
return (
Expand All @@ -33,8 +30,6 @@ const HeaderMain: React.FC<HeaderMainProps> = props => {
<GithubButton />
<QuestionButton />
<DmToggleButton onDmToggleChange={() => null} />
<Divider orientation="vertical" />
<ExitButton onClick={props.onLogout} />
</HStack>
</>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export {default as HeaderMain, HeaderMainProps} from './HeaderMain'
export {default as HotbarMain, HotbarMainProps} from './HotbarMain'
export {default as FooterMain} from './FooterMain'
export {default as FooterMain, FooterMainProps} from './FooterMain'
export {default as LoginMain, LoginMainProps} from './LoginMain'
export {default as TabsMain, TabsMainProps} from './TabsMain'
2 changes: 1 addition & 1 deletion packages/jaen/src/containers/MainUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const MainUI: React.FC<MainUIProps> = ({ui: {hotbar, tabs}}) => {
<LoadableUI
hotbar={hotbar}
tabs={tabs}
header={{onLogout: handleLogout}}
footer={{onLogout: handleLogout}}
authenticated={authenticated}
login={{onLogin: handleLogin, onGuestLogin: handleGuestLogin}}
/>
Expand Down

0 comments on commit d9d82a2

Please sign in to comment.