-
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
headeroption has split into two separate options,headerVariantandheaderComponent. 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 theheaderComponentoption. -
The
footeroption has been split into two separate options,footerVariantandfooterComponent. 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 thefooterComponentoption.
- The
disableStickyoption has been replaced with theshowStickyHeaderoption which is enabled by default. To disable the sticky header either configure this option by passingheaderOptionsto the layout component or by setting theshowStickyHeaderprop 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-foundationat 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-foundationsas 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
stylesheetsoption passed to the shell component:
<Shell stylesheets={[ + ...assets.loader.getStylesheetURLsFor('page-kit-layout-styles'), ...assets.loader.getStylesheetURLsFor('styles') ]} /> - Add the generated stylesheet to the