Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UpMenu new design #344

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/Components/Display/Menu/UpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,30 @@ class UpMenu extends React.Component<UpMenuProps & WithThemeProps, UpMenuState>
<section className="up-menu-header">
{renderIcon && <section className="up-app-icon-wrapper">{renderIcon}</section>}
{renderHeader}
{!this.props.blocked && isMobileDevice() && (
<UpSvgIcon
width={15}
height={15}
iconName={'burger-menu2'}
className="up-menu-toggle"
onClick={this.toggleMinification}
style={{ marginLeft: 'auto', marginRight: 10 }}
></UpSvgIcon>
)}
</section>
{!isMobileDevice() && (
<div className="up-menu-actions">
{!this.props.blocked && (
<UpSvgIcon
width={18}
height={18}
width={15}
height={15}
iconName={'burger-menu2'}
className="up-menu-toggle"
onClick={this.toggleMinification}
></UpSvgIcon>
)}
</div>
</section>
)}
<section className="up-menu-nav">
<nav>
<ul>{menu}</ul>
Expand Down Expand Up @@ -243,9 +255,10 @@ export class MenuItem extends React.Component<MenuItemProps> {
{isString(this.props.icon) && (
<UpSvgIcon
title={this.props.title}
width={22}
height={22}
width={24}
height={24}
iconName={this.props.icon as IconName}
color="#000"
></UpSvgIcon>
)}
{isFunction(this.props.icon) && this.props.icon(this.props)}
Expand Down Expand Up @@ -360,9 +373,10 @@ export class SubItems extends React.Component<SubItemsProps, SubItemsState> {
render() {
const hide = this.props.isVisible === false ? ' hide' : '';
const active = this.state.active || this.props.isSelected ? 'active' : '';
const hasChildren = this.anyChild ? ' hasChildren' : '';

return (
<li className={active + hide}>
<li className={active + hide + hasChildren}>
<a onClick={this.onClickA} href={this.props.uri}>
<span className={'up-menu-item-title'}>{this.props.title}</span>
{this.anyChild && (
Expand All @@ -384,7 +398,7 @@ export class SubItems extends React.Component<SubItemsProps, SubItemsState> {
const UpMenuDefaultHeader = (props: { title: string }, state: { minified: boolean }) => (
<UpBox flexDirection={'row'} alignItems={'center'} justifyContent={'center'} style={{ height: '100%' }}>
{!state.minified && (
<UpLigne color={colorMap.primary} className={style({ marginLeft: '8px' })}>
<UpLigne color={colorMap.white} className={style({ marginLeft: '8px' })}>
{props.title}
</UpLigne>
)}
Expand Down
114 changes: 68 additions & 46 deletions src/Components/Display/Menu/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getRootContainer } from '../../../Common/stories';
import { DeviceSmartphones } from '../../../Common/utils/device';

import logoSvg from './sources/logo-up-square.svg';
import { toRem } from '../../../Common/theming/utils';

export default {
title: 'Components/Display/UpMenu',
Expand Down Expand Up @@ -51,7 +52,7 @@ const setMenuSelection = (uri: string, menu: Array<MenuItemData>, prev?: Array<M
const defaultMenu: Array<MenuItemData> = [
{
title: 'Stack',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/stack',
Expand Down Expand Up @@ -102,7 +103,7 @@ const defaultMenu: Array<MenuItemData> = [
{ isSeparator: true },
{
title: 'Up',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/Up',
Expand Down Expand Up @@ -145,17 +146,19 @@ const defaultMenu: Array<MenuItemData> = [
{
render: (item: MenuItemData, propsMenu: UpMenuProps, state: UpMenuState) => {
return (
<UpButton
intent={'primary'}
onClick={e => {
action('Command');
}}
width={state.minified ? 'icon' : 'full'}
height={'large'}
actionType={'briefcase'}
>
{'Commander'}
</UpButton>
<div style={{ paddingRight: toRem(14) }}>
<UpButton
intent={'primary'}
onClick={e => {
action('Command');
}}
width={state.minified ? 'icon' : 'full'}
height={'large'}
actionType={'briefcase'}
>
{'Commander'}
</UpButton>
</div>
);
},
},
Expand Down Expand Up @@ -322,7 +325,12 @@ export const GeneralWithCustomHeader = props => {
}}
header={(props: Partial<UpMenuProps>, state: UpMenuState) => {
return (
<UpBox flexDirection={'row'} alignItems={'center'} justifyContent={'center'} style={{ height: '100%' }}>
<UpBox
flexDirection={'row'}
alignItems={'center'}
justifyContent={'center'}
style={{ height: '100%', marginLeft: 10 }}
>
{!state.minified && <UpSvgIcon color={colorMap.primary} iconName={'checkmark'} />}
{!state.minified && (
<UpLigne
Expand All @@ -346,7 +354,7 @@ export const Large = props => {
const defaultMenu: Array<MenuItemData> = [
{
title: 'Stack',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/stack',
Expand Down Expand Up @@ -387,7 +395,7 @@ export const Large = props => {
},
{
title: 'Up',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/Up',
Expand Down Expand Up @@ -430,7 +438,7 @@ export const Large = props => {
{ isSeparator: true },
{
title: 'Stack',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/stack',
Expand Down Expand Up @@ -464,17 +472,19 @@ export const Large = props => {
{
render: (item: MenuItemData, propsMenu: UpMenuProps, state: UpMenuState) => {
return (
<UpButton
intent={'primary'}
onClick={e => {
action('Command');
}}
width={state.minified ? 'icon' : 'full'}
height={'large'}
actionType={'briefcase'}
>
{'Commander'}
</UpButton>
<div style={{ paddingRight: toRem(14) }}>
<UpButton
intent={'primary'}
onClick={e => {
action('Command');
}}
width={state.minified ? 'icon' : 'full'}
height={'large'}
actionType={'briefcase'}
>
{'Commander'}
</UpButton>
</div>
);
},
},
Expand Down Expand Up @@ -513,7 +523,7 @@ export const Large = props => {
},
{
title: 'Other',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/Other',
Expand Down Expand Up @@ -546,7 +556,7 @@ export const Large = props => {
},
{
title: 'Logo',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/Logo',
Expand Down Expand Up @@ -771,7 +781,12 @@ export const Large = props => {
}}
header={(props: Partial<UpMenuProps>, state: UpMenuState) => {
return (
<UpBox flexDirection={'row'} alignItems={'center'} justifyContent={'center'} style={{ height: '100%' }}>
<UpBox
flexDirection={'row'}
alignItems={'center'}
justifyContent={'center'}
style={{ height: '100%', marginLeft: 10 }}
>
{!state.minified && <UpSvgIcon color={colorMap.primary} iconName={'checkmark'} />}
{!state.minified && (
<UpLigne
Expand All @@ -794,7 +809,7 @@ export const CustomStyles = props => {
const defaultMenu: Array<MenuItemData> = [
{
title: 'Stack',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/stack',
Expand Down Expand Up @@ -846,17 +861,19 @@ export const CustomStyles = props => {
{
render: (item: MenuItemData, propsMenu: UpMenuProps, state: UpMenuState) => {
return (
<UpButton
intent={'primary'}
onClick={e => {
action('Command');
}}
width={state.minified ? 'icon' : 'full'}
height={'large'}
actionType={'briefcase'}
>
{'Commander'}
</UpButton>
<div style={{ paddingRight: toRem(14) }}>
<UpButton
intent={'primary'}
onClick={e => {
action('Command');
}}
width={state.minified ? 'icon' : 'full'}
height={'large'}
actionType={'briefcase'}
>
{'Commander'}
</UpButton>
</div>
);
},
},
Expand Down Expand Up @@ -942,7 +959,12 @@ export const CustomStyles = props => {
}}
header={(props: Partial<UpMenuProps>, state: UpMenuState) => {
return (
<UpBox flexDirection={'row'} alignItems={'center'} justifyContent={'center'} style={{ height: '100%' }}>
<UpBox
flexDirection={'row'}
alignItems={'center'}
justifyContent={'center'}
style={{ height: '100%', marginLeft: 10 }}
>
{!state.minified && <UpSvgIcon color={colorMap.primary} iconName={'checkmark'} />}
{!state.minified && (
<UpLigne
Expand Down Expand Up @@ -982,7 +1004,7 @@ export const Mobile = props => {
const defaultMenu: Array<MenuItemData> = [
{
title: 'Stack',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/stack',
Expand Down Expand Up @@ -1033,7 +1055,7 @@ export const Mobile = props => {
{ isSeparator: true },
{
title: 'Up',
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={22} height={22} />,
icon: propsIcon => <UpSvgIcon iconHtml={logoSvg} width={24} height={24} />,
isSelected: false,
isVisible: true,
uri: '/Up',
Expand Down
Loading