Skip to content
Snippets Groups Projects
Commit c3a010c5 authored by Tuukka Turu's avatar Tuukka Turu
Browse files

More mobile related things, work in progress

parent 2ea4dc7e
No related branches found
No related tags found
No related merge requests found
...@@ -629,6 +629,11 @@ export namespace Components { ...@@ -629,6 +629,11 @@ export namespace Components {
interface HyMenuMainGroup { interface HyMenuMainGroup {
dataMainMenu: MainMenu[] | string; dataMainMenu: MainMenu[] | string;
isMobile: boolean; isMobile: boolean;
logoLabelGroup?: string;
logoSizeGroup?: any;
logoUrlGroup?: string;
siteLabel?: string;
siteUrl?: string;
} }
interface HyMenuMobileBreadcrumb { interface HyMenuMobileBreadcrumb {
bid: string; bid: string;
...@@ -2009,6 +2014,11 @@ declare namespace LocalJSX { ...@@ -2009,6 +2014,11 @@ declare namespace LocalJSX {
interface HyMenuMainGroup { interface HyMenuMainGroup {
dataMainMenu?: MainMenu[] | string; dataMainMenu?: MainMenu[] | string;
isMobile?: boolean; isMobile?: boolean;
logoLabelGroup?: string;
logoSizeGroup?: any;
logoUrlGroup?: string;
siteLabel?: string;
siteUrl?: string;
} }
interface HyMenuMobileBreadcrumb { interface HyMenuMobileBreadcrumb {
bid?: string; bid?: string;
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
display: flex; display: flex;
flex-flow: row; flex-flow: row;
margin-left: 28px; margin-left: 28px;
position: relative;
@include breakpoint($narrow) { @include breakpoint($narrow) {
margin-left: 32px; margin-left: 32px;
...@@ -110,3 +111,48 @@ ...@@ -110,3 +111,48 @@
background: transparent; background: transparent;
padding: 15px 28px 15px 15px; padding: 15px 28px 15px 15px;
} }
.menu--main-group__dropdown__top {
}
.menu--main-group__dropdown__items {
}
.menu--main-group__dropdown__donate {
}
.menu--main-group__dropdown--mobile {
place-items: stretch;
//inset: 0px;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
justify-items: space-between;
background-color: var(--grayscale-black);
bottom: 0px;
overflow: hidden;
padding: 0px;
position: fixed;
right: 0px;
top: 0px;
transform: translateX(100%);
transition: all 0.3s ease 0s;
visibility: hidden;
width: 0px;
&.is-open {
padding: 20px;
transform: translateX(0px);
visibility: visible;
width: 90%;
z-index: 100;
padding-top: 50px;
transition: transform 0.3s cubic-bezier(0, 0, 0.3, 1);
&::after {
opacity: 1;
visibility: visible;
}
}
}
...@@ -5,6 +5,8 @@ export interface MainMenu { ...@@ -5,6 +5,8 @@ export interface MainMenu {
} }
import {Component, Host, h, Element, Prop, State, Watch, Listen} from '@stencil/core'; import {Component, Host, h, Element, Prop, State, Watch, Listen} from '@stencil/core';
import {ColorVariant, SiteLogoSize} from '../../../utils/utils';
import {DonateLink} from '../../site-header/site-header';
@Component({ @Component({
tag: 'hy-menu-main-group', tag: 'hy-menu-main-group',
...@@ -15,7 +17,13 @@ export class HyMenuMainGroup { ...@@ -15,7 +17,13 @@ export class HyMenuMainGroup {
@Element() el: HTMLElement; @Element() el: HTMLElement;
@Prop() dataMainMenu: MainMenu[] | string; @Prop() dataMainMenu: MainMenu[] | string;
@Prop() isMobile: boolean = false; @Prop() isMobile: boolean = false;
@Prop() logoUrlGroup?: string;
@Prop() logoSizeGroup?: any;
@Prop() logoLabelGroup?: string;
@Prop() siteLabel?: string;
@Prop() siteUrl?: string;
@State() isMenuOpen: boolean = false; @State() isMenuOpen: boolean = false;
private donateLink: DonateLink[];
private _dataMainMenu: MainMenu[]; private _dataMainMenu: MainMenu[];
...@@ -56,6 +64,8 @@ export class HyMenuMainGroup { ...@@ -56,6 +64,8 @@ export class HyMenuMainGroup {
render() { render() {
const white = 'var(--grayscale-white)'; const white = 'var(--grayscale-white)';
const logoSizeGroup = this.isMobile ? SiteLogoSize.small : SiteLogoSize.small;
const logoColorGroup = ColorVariant.white;
return this.isMobile ? ( return this.isMobile ? (
<Host <Host
...@@ -74,12 +84,25 @@ export class HyMenuMainGroup { ...@@ -74,12 +84,25 @@ export class HyMenuMainGroup {
</button> </button>
<nav <nav
role="navigation" role="navigation"
aria-hidden={this.isMenuOpen ? 'false' : 'true'}
class={{ class={{
'menu--main-group__dropdown--mobile': true, 'menu--main-group__dropdown--mobile': true,
'is-open': this.isMenuOpen, 'is-open': this.isMenuOpen,
}} }}
> >
<div class="list"> <div class="menu--main-group__dropdown__top">
<hy-site-logo
is-group={true}
size={logoSizeGroup}
color={logoColorGroup}
url={this.siteUrl}
label={this.siteLabel}
/>
<button class="menu--main-group__dropdown__close" onClick={() => this.isMenuOpen == false}>
CLOSE ME
</button>
</div>
<div class="menu--main-group__dropdown__items">
{this._dataMainMenu.map((item) => { {this._dataMainMenu.map((item) => {
return ( return (
<a href={item.url} class={{'menu-main-link': true}}> <a href={item.url} class={{'menu-main-link': true}}>
...@@ -91,6 +114,16 @@ export class HyMenuMainGroup { ...@@ -91,6 +114,16 @@ export class HyMenuMainGroup {
); );
})} })}
</div> </div>
<div class="menu--main-group__dropdown__donate">
{this.donateLink.map((i) => {
return (
<a class={'menu--secondary__item hy-link__donate group'} href={i.url}>
<hy-icon icon={'hy-icon-heart-support'} size={14} fill={logoColorGroup} />
<span class={'hy-link__donate__label group'}>{i.label}</span>
</a>
);
})}
</div>
</nav> </nav>
</Host> </Host>
) : ( ) : (
......
...@@ -4,10 +4,15 @@ ...@@ -4,10 +4,15 @@
## Properties ## Properties
| Property | Attribute | Description | Type | Default | | Property | Attribute | Description | Type | Default |
| -------------- | ---------------- | ----------- | ---------------------- | ----------- | | ---------------- | ------------------ | ----------- | ---------------------- | ----------- |
| `dataMainMenu` | `data-main-menu` | | `MainMenu[] \| string` | `undefined` | | `dataMainMenu` | `data-main-menu` | | `MainMenu[] \| string` | `undefined` |
| `isMobile` | `is-mobile` | | `boolean` | `false` | | `isMobile` | `is-mobile` | | `boolean` | `false` |
| `logoLabelGroup` | `logo-label-group` | | `string` | `undefined` |
| `logoSizeGroup` | `logo-size-group` | | `any` | `undefined` |
| `logoUrlGroup` | `logo-url-group` | | `string` | `undefined` |
| `siteLabel` | `site-label` | | `string` | `undefined` |
| `siteUrl` | `site-url` | | `string` | `undefined` |
## Dependencies ## Dependencies
...@@ -18,12 +23,15 @@ ...@@ -18,12 +23,15 @@
### Depends on ### Depends on
- [hy-icon](../../icon) - [hy-icon](../../icon)
- [hy-site-logo](../../site-header/site-logo)
### Graph ### Graph
```mermaid ```mermaid
graph TD; graph TD;
hy-menu-main-group --> hy-icon hy-menu-main-group --> hy-icon
hy-menu-main-group --> hy-site-logo
hy-site-logo --> hy-icon
hy-site-header --> hy-menu-main-group hy-site-header --> hy-menu-main-group
style hy-menu-main-group fill:#f9f,stroke:#333,stroke-width:4px style hy-menu-main-group fill:#f9f,stroke:#333,stroke-width:4px
``` ```
......
...@@ -54,6 +54,7 @@ graph TD; ...@@ -54,6 +54,7 @@ graph TD;
hy-site-header --> hy-desktop-menu-links hy-site-header --> hy-desktop-menu-links
hy-site-logo --> hy-icon hy-site-logo --> hy-icon
hy-menu-main-group --> hy-icon hy-menu-main-group --> hy-icon
hy-menu-main-group --> hy-site-logo
hy-menu-language --> hy-menu-language-item hy-menu-language --> hy-menu-language-item
hy-menu-language --> hy-icon hy-menu-language --> hy-icon
hy-site-search --> hy-icon hy-site-search --> hy-icon
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
- [hy-footer-base](../../footer/hy-footer-base) - [hy-footer-base](../../footer/hy-footer-base)
- [hy-menu](../../navigation/menu) - [hy-menu](../../navigation/menu)
- [hy-menu-main-group](../../navigation/hy-menu-main-group)
- [hy-menu-sidebar](../../navigation/menu-sidebar) - [hy-menu-sidebar](../../navigation/menu-sidebar)
- [hy-site-header](..) - [hy-site-header](..)
- [hy-user-login-form](../../hy-user-login-form) - [hy-user-login-form](../../hy-user-login-form)
...@@ -34,6 +35,7 @@ graph TD; ...@@ -34,6 +35,7 @@ graph TD;
hy-site-logo --> hy-icon hy-site-logo --> hy-icon
hy-footer-base --> hy-site-logo hy-footer-base --> hy-site-logo
hy-menu --> hy-site-logo hy-menu --> hy-site-logo
hy-menu-main-group --> hy-site-logo
hy-menu-sidebar --> hy-site-logo hy-menu-sidebar --> hy-site-logo
hy-site-header --> hy-site-logo hy-site-header --> hy-site-logo
hy-user-login-form --> hy-site-logo hy-user-login-form --> hy-site-logo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment