Skip to content

Commit

Permalink
Update format for NSW version in footer to include the DDS version (#185
Browse files Browse the repository at this point in the history
)
  • Loading branch information
JeffersonBledsoe authored Dec 7, 2023
1 parent 49848f0 commit 3266839
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
34 changes: 34 additions & 0 deletions src/components/DesignSystemVersionInformation.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { FormattedMessage } from 'react-intl';

import nswPackageJson from 'nsw-design-system/package.json';

export function DesignSystemVersionInformation() {
let designSystemVersion = nswPackageJson?.version;
try {
designSystemVersion = designSystemVersion.split('.').slice(0, 2).join('.');
} catch {
console.warn(
'Failed to fetch valid design system version: ',
designSystemVersion,
);
}

if (!designSystemVersion) {
return (
<FormattedMessage
id="NSW Built with - plone only"
defaultMessage="NSW DDS Plone"
/>
);
}

return (
<FormattedMessage
id="NSW Built with - DDS and Plone"
defaultMessage="NSW DDS Plone {ddsVersion}"
values={{
ddsVersion: designSystemVersion,
}}
/>
);
}
6 changes: 4 additions & 2 deletions src/customizations/volto/components/theme/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import { getTextColourUtilityForPaletteName } from 'nsw-design-system-plone6/hel
import { useEffect } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useDispatch, useSelector } from 'react-redux';
import { Link } from 'react-router-dom';
import { getSubFooter } from 'volto-subfooter';

import { DesignSystemVersionInformation } from 'nsw-design-system-plone6/components/DesignSystemVersionInformation';
import { Link } from 'react-router-dom';

// TODO: Would dynamically importing these reduce bundle size?
import FacebookSVG from '@mdi/svg/svg/facebook.svg';
import LinkedInSVG from '@mdi/svg/svg/linkedin.svg';
Expand Down Expand Up @@ -246,7 +248,7 @@ function Footer() {
<div className="nsw-footer__built">
{intl.formatMessage(messages.builtWith)}
<a href="https://digitalnsw.pretagov.com.au" rel="external">
Plone 6 NSW DS
<DesignSystemVersionInformation />
</a>
</div>
</div>
Expand Down

0 comments on commit 3266839

Please sign in to comment.