Collection of top level page components for use in MOLGENIS interface
You can use this library in 2 different ways. You use the source components from ui-context.
<page-component>
<p>I am a MOLGENIS page with, header and footer</p>
</page-component>
HeaderImageComponent may also be used as separate components Please be sure to build your project and include the peer dependencies (check installation).
The second way is to import the umd's, but Vue and the peer dependencies are packaged as well. This means you have to import the umd modules in a separate Vue in the page.
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js"></script>
<script>
requirejs.config({
baseUrl: '/@molgenis-ui/context/dist/'
});
requirejs(["context.umd", "https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"], function(context, Vue) {
new Vue({
render: createElement => {
const propsData = {
props: {
molgenisMenu: {
menu: ${menu},
<#if app_settings.logoTopHref??>topLogo: '${app_settings.logoTopHref}', </#if>
<#if app_settings.logoTopHref??>topLogoMaxHeight: ${app_settings.logoTopMaxHeight}, </#if>
<#if app_settings.logoNavBarHref?has_content>navBarLogo: '${app_settings.logoNavBarHref}', </#if>
<#if plugin_id??>selectedPlugin: '${plugin_id}', </#if>
authenticated: ${authenticated?c},
loginHref: '/login',
helpLink: {
label: 'Help',
href: 'https://molgenis.gitbooks.io/molgenis/content/'
}
}
}
};
return createElement(context.default.HeaderComponent, propsData);
}
}).$mount('#molgenis-menu')
})
</script>
If you use Vuex, the fetchContext
action will retrieve the values for the component props from the context API.
It returns a promise that resolves when the context has been fetched.
import { store } from '@molgenis/molgenis-ui-context'
const store = new Vuex.Store(store)
store.dispatch('fetchContext')
Once fetched, the context will be available in store.state.context
.
The getters map the context to the props, i.e. the molgenisMenu
prop to set on the HeaderComponent
can be retrieved from store.getters.molgenisMenu
If you already have a store, you can combine the context store with your own store as a vuex module.
Details changes for each release are documented in the CHANGELOG.md.
Combination of 'Cookie wall', 'Header component' and 'Footer compoment'. Emits 'contextLoaded' event containing contextData when data is returned from backend.
Sticky header that contains HeaderImageComponent and Navbar. Takes a MOLGENIS menu object as property and renders a menu and top logo image (if set MOLGENIS menu object). Header is fixed at the top of the page).
Sticky footer, takes a MOLGENIS footer object as property and renders a footer. Footers is rendered at the botom of the window and pushed down by the content.
Shows cookie warning if 'permissionforcookies' cookie is not set. If user accepts cookies the 'permissionforcookies' is set.
------------------------------------------
| page |
| ------------------------------------ |
| | sticky-header | |
| | ------------------------------- | |
| | | header-image | | |
| | | | | |
| | ------------------------------- | |
| | ------------------------------- | |
| | | nav-bar | | |
| | ------------------------------- | |
| ------------------------------------ |
| ------------------------------------ |
| | content | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| ------------------------------------ |
| ------------------------------------ |
| |footer | |
| | | |
| | | |
| ------------------------------------ |
------------------------------------------
yarn install
yarn run serve
yarn run build
The default build target is set to build the all tlhe components as library
yarn run test
yarn run lint
yarn run test:e2e
yarn run test:unit
We use conventional commits to generate changelogs and release notes. Please check: https://www.conventionalcommits.org/
Example
git commit file.ext -m "fix(file.ext): fixes something"
Each time a PR is merged a release will be done to NPM. The CHANGELOG.md and GitHub release will be ammended.
The version of the package is based upon convential commits. Check: http://commitizen.github.io/cz-cli/.