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

Forward root element styles to mobile navigation menu #1562

Merged
merged 5 commits into from
May 5, 2021
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
3 changes: 2 additions & 1 deletion docs/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
36 changes: 35 additions & 1 deletion docs/userGuide/syntax/navBars.mbdf
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,38 @@ By default, if the `lower-navbar` slot is not specified, the site and page navig
Component | Description
--- | ---
`page-nav-button` | Pulls any element with an identifier, `id=page-nav` into the menu. If no such element exists, it pulls any [page navigation menu]({{ baseUrl }}/userGuide/usingComponents.html#page-navigation-menus) used in the layout.
`site-nav-button` | Pulls any element with an identifier, `id=site-nav` into the menu. If no such element exists, it pulls all [site navigation menu components]({{ baseUrl }}/userGuide/usingComponents.html#site-navigation-menus) used in the layout.
`site-nav-button` | Pulls any element with an identifier, `id=site-nav` into the menu. If no such element exists, it pulls all [site navigation menu components]({{ baseUrl }}/userGuide/usingComponents.html#site-navigation-menus) used in the layout.

****Styling the mobile page and site navigation menus****

You may also wish to style your navigation content differently on mobile view.
By default, MarkBind already provides some reasonable overrides for smaller screens, applied over any styles you might have for the mobile navigation content identified above.

```css {.no-line-numbers heading="Css class attached to the root navigation element"}
.mb-mobile-nav {
display: block !important;
margin: 0 !important;
border: none !important;
padding: 10px !important;
width: 100% !important;
max-width: 100% !important;
}
```

If you require greater customisation, you may simply compose the respective selectors with the `.mb-mobile-nav` element.

{{ icon_example }}

```css {.no-line-numbers heading=""}
#site-nav.mb-mobile-nav {
/* Be sure to add the !important css rule when overriding .mb-mobile-nav's properties! */
border: 1px solid black !important;
/* For other properties, there is no need. */
color: red;
}
```

<box type="tip" seamless>

Refer to the [layouts](../tweakingThePageStructure.md) section to find out how to add custom css files to a page!
</box>
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/core/template/default/stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mark {
#flex-body {
display: flex;
flex: 1;
align-items: start;
}

#content-wrapper {
Expand Down Expand Up @@ -91,11 +92,11 @@ mark {

#page-nav {
display: block;
border-left: 1px solid lightgrey;
max-height: 90vh;
}

#page-nav .nav-component {
border-left: 1px solid lightgrey;
max-height: 90vh;
}

Expand Down
20 changes: 19 additions & 1 deletion packages/vue-components/src/OverlaySource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
<component :is="tagName" v-bind="$attrs">
<slot></slot>
<portal v-if="enablePortal" :to="to">
<slot></slot>
<component
:is="tagName"
v-bind="$attrs"
:class="[$vnode.data.staticClass || '', 'mb-mobile-nav']"
:style="$vnode.data.staticStyle"
>
<slot></slot>
</component>
</portal>
</component>
</template>
Expand Down Expand Up @@ -36,3 +43,14 @@ export default {
},
};
</script>

<style scoped>
.mb-mobile-nav {
display: block !important;
margin: 0 !important;
border: none !important;
padding: 10px !important;
width: 100% !important;
max-width: 100% !important;
}
</style>