-
Notifications
You must be signed in to change notification settings - Fork 6
Upgrading from 0.3.x to 0.4.x
This guide is suitable for most FT.com apps which have followed the n-ui
to Page Kit migration guide.
Please ensure the app is using n-gage >= 4.0.0-beta.2
and n-heroku-tools >= v8.4.0
which support uploading the compressed assets generated by this version of Page Kit.
-
The
header
option has split into two separate options,headerVariant
andheaderComponent
. If the app sets a built-in variant (either"simple"
or"large-logo"
) you must update the option toheaderVariant
. If the app is providing a custom header component you need to refactor to use theheaderComponent
option. -
The
footer
option has been split into two separate options,footerVariant
andfooterComponent
. If the app sets a built-in variant (either"simple"
or"legal"
) you must update the option tofooterVariant
. If the app is providing a custom footer component you need to refactor to use thefooterComponent
option.
- The
disableSticky
option has been replaced with theshowStickyHeader
option which is enabled by default. To disable the sticky header either configure this option by passingheaderOptions
to the layout component or by setting theshowStickyHeader
prop when integrating the header component directly.
Please hold off from implementing this. Due to the ongoing Origami component upgrade work there are a lot of other style-related changes happening.
The layout component styles can now be built as an individual entrypoint which has the benefit of improving long-term caching and potentially sharing the styles between applications. To enable this:
-
Install
n-ui-foundation
at v3.2.0 or greater:bower i -S n-ui-foundations@^3.2.0
-
Open the application's main stylesheet and update the following line:
- @import '@financial-times/dotcom-ui-layout/styles'; + @import 'n-ui-foundations/mixins';
Please note that you may need to add
n-ui-foundations
as a Bower dependency of the app. -
Open the application's Page Kit build configuration and add the layout styles as an entry point:
module.exports = { plugins: [...], settings: { build: { entry: { scripts: './client/main.js', styles: './client/main.scss', + 'page-kit-layout-styles': require.resolve('@financial-times/dotcom-ui-layout/styles.scss') } } } }
Please note that the name of the entry point must be
"page-kit-layout-styles"
in order for the stylesheet to be reused between applications.- Add the generated stylesheet to the
stylesheets
option passed to the shell component:
<Shell stylesheets={[ + ...assets.loader.getStylesheetURLsFor('page-kit-layout-styles'), ...assets.loader.getStylesheetURLsFor('styles') ]} />
- Add the generated stylesheet to the