diff --git a/src/components/Sidebar/Sidebar.scss b/src/components/Sidebar/Sidebar.scss index 0e6e4b4..a033c41 100644 --- a/src/components/Sidebar/Sidebar.scss +++ b/src/components/Sidebar/Sidebar.scss @@ -1,4 +1,4 @@ -@use '../../utils/variables'; +@use '../../utils/variables' as var; .sidebar { box-shadow: 0 0 1rem 0 #00000026,0 0 .625rem 0 #00000026; @@ -6,7 +6,7 @@ right: 0; bottom: 0; z-index: 9999; - background-color: white; + background-color: var.$white; width: 100%; max-width: 25rem; @@ -44,6 +44,14 @@ .trial-header { font-size: 0.9em; - background-color: #F49974; + background-color: var.$brand-100; + font-size: 0.875rem; + line-height: 1.5rem; + padding: 0.5rem 0.75rem; + color: var.$black; + + a { + text-decoration: underline; + } } } diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index f8cb8e2..71e722c 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -65,21 +65,22 @@ const Sidebar = ({ ); - const getDaysRemainingMessage = () => { // eslint-disable-line consistent-return - if (auditTrialDaysRemaining > 1) { - const intlRelativeTime = new Intl.RelativeTimeFormat({ style: 'long' }); - return ( -
- Your trial ends {intlRelativeTime.format(auditTrialDaysRemaining, 'day')}. {getUpgradeLink()} for full access to Xpert. -
- ); - } if (auditTrialDaysRemaining === 1) { - return ( -
- Your trial ends today! {getUpgradeLink()} for full access to Xpert. -
- ); - } + const getDaysRemainingMessage = () => { + if (!upgradeable || auditTrialDaysRemaining < 1) { return null; } + + return ( +
+ {auditTrialDaysRemaining === 1 ? ( +
+ Your trial ends today! {getUpgradeLink()} for full access to Xpert. +
+ ) : ( +
+ {auditTrialDaysRemaining} days remaining. {getUpgradeLink()} for full access to Xpert. +
+ )} +
+ ); }; const getSidebar = () => ( @@ -90,12 +91,9 @@ const Sidebar = ({
- {upgradeable - && ( -
- {getDaysRemainingMessage()} -
- )} + + {getDaysRemainingMessage()} + { apiError diff --git a/src/components/Sidebar/index.test.jsx b/src/components/Sidebar/index.test.jsx index 2f6f542..5b81808 100644 --- a/src/components/Sidebar/index.test.jsx +++ b/src/components/Sidebar/index.test.jsx @@ -114,7 +114,7 @@ describe('', () => { render(undefined, { disclosureAcknowledged: true }); expect(screen.queryByTestId('sidebar-xpert')).toBeInTheDocument(); expect(screen.queryByTestId('get-days-remaining-message')).toBeInTheDocument(); - expect(screen.queryByTestId('trial-ends-today')).not.toBeInTheDocument(); + expect(screen.queryByTestId('trial-ends-today-message')).toBeInTheDocument(); }); it('should call track event on click', () => { @@ -141,9 +141,9 @@ describe('', () => { }); render(undefined, { disclosureAcknowledged: true }); expect(screen.queryByTestId('sidebar-xpert')).toBeInTheDocument(); - expect(screen.queryByTestId('get-days-remaining-message')).toBeInTheDocument(); + expect(screen.queryByTestId('get-days-remaining-message')).not.toBeInTheDocument(); expect(screen.queryByTestId('days-remaining-message')).not.toBeInTheDocument(); - expect(screen.queryByTestId('trial-ends-today')).not.toBeInTheDocument(); + expect(screen.queryByTestId('trial-ends-today-message')).not.toBeInTheDocument(); }); }); diff --git a/src/utils/_variables.scss b/src/utils/_variables.scss index 25626ed..150796d 100644 --- a/src/utils/_variables.scss +++ b/src/utils/_variables.scss @@ -5,3 +5,8 @@ $accent-yellow: #f0cc00; $gray-200: #cccccc !default; $gray-300: #adadad !default; $gray-400: #8f8f8f !default; + +$brand-100: #F49974; + +$black: #000; +$white: #fff;