Skip to content

Commit

Permalink
Move link text into subtitle translations
Browse files Browse the repository at this point in the history
  • Loading branch information
zanewoodfin committed Jul 27, 2020
1 parent 58d0e15 commit 595c645
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 45 deletions.
5 changes: 2 additions & 3 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@
"tourDescription": "We'll walk you through each step, and include insight into how Red Hat collects and uses subscription data."
},
"curiosity-view": {
"learnMore": "Learn more about Subscription Watch reporting",
"OpenShiftTitle": "Red Hat OpenShift",
"OpenShiftSubtitle": "Monitor your Red Hat OpenShift usage by socket or core usage, based on your subscription terms.",
"OpenShiftSubtitle": "Monitor your Red Hat OpenShift usage by socket or core usage, based on your subscription terms. <0>Learn more about Subscription Watch reporting</0>",
"RHELTitle": "Red Hat Enterprise Linux",
"RHELSubtitle": "Monitor your Red Hat Enterprise Linux usage by physical, virtual, and public cloud sockets."
"RHELSubtitle": "Monitor your Red Hat Enterprise Linux usage by physical, virtual, and public cloud sockets. <0>Learn more about Subscription Watch reporting</0>"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

exports[`PageHeader Component should render a basic component: basic 1`] = `
<PageHeader
t={[Function]}
viewId={null}
>
<PageHeader>
Expand Down Expand Up @@ -46,7 +45,6 @@ exports[`PageHeader Component should render a basic component: basic 1`] = `

exports[`PageHeader Component should render string node types: string 1`] = `
<PageHeader
t={[Function]}
viewId={null}
>
<PageHeader>
Expand Down Expand Up @@ -80,7 +78,6 @@ exports[`PageHeader Component should render string node types: string 1`] = `

exports[`PageHeader Component should render the subtitle when viewId is provided: with subtitle 1`] = `
<PageHeader
t={[Function]}
viewId="RHEL"
>
<PageHeader>
Expand Down Expand Up @@ -108,30 +105,7 @@ exports[`PageHeader Component should render the subtitle when viewId is provided
</Title>
</PageHeaderTitle>
<p>
t(curiosity-view.RHELSubtitle)
<Button
component="a"
href="https://access.redhat.com/documentation/en-us/subscription_central/2020-04/html/getting_started_with_subscription_watch/con-how-does-subscriptionwatch-show-data_assembly-opening-subscriptionwatch-ctxt/"
isInline={true}
target="_blank"
variant="link"
>
<a
aria-disabled={false}
aria-label={null}
className="pf-c-button pf-m-link pf-m-inline"
data-ouia-component-id={0}
data-ouia-component-type="PF4/Button"
data-ouia-safe={true}
disabled={null}
href="https://access.redhat.com/documentation/en-us/subscription_central/2020-04/html/getting_started_with_subscription_watch/con-how-does-subscriptionwatch-show-data_assembly-opening-subscriptionwatch-ctxt/"
target="_blank"
type={null}
>
t(curiosity-view.learnMore)
</a>
</Button>
t(curiosity-view.RHELSubtitle, [object Object], [object Object])
</p>
</section>
</PageHeader>
Expand Down
26 changes: 11 additions & 15 deletions src/components/pageLayout/pageHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,30 @@ import {
PageHeaderTitle
} from '@redhat-cloud-services/frontend-components/components/cjs/PageHeader';
import { Button } from '@patternfly/react-core';
import { helpers } from '../../common';
import { translate } from '../i18n/i18n';

/**
* Render a platform page header.
*
* @param {object} props
* @param {Node} props.children
* @param {Function} props.t
* @param {string} props.viewId
* @returns {Node}
*/
const PageHeader = ({ children, t, viewId }) => (
const PageHeader = ({ children, viewId }) => (
<RcsPageHeader>
<PageHeaderTitle title={children} />
{viewId && (
<p>
{t(`curiosity-view.${viewId}Subtitle`)}{' '}
<Button
isInline
component="a"
variant="link"
target="_blank"
href="https://access.redhat.com/documentation/en-us/subscription_central/2020-04/html/getting_started_with_subscription_watch/con-how-does-subscriptionwatch-show-data_assembly-opening-subscriptionwatch-ctxt/"
>
{t('curiosity-view.learnMore')}
</Button>
{translate(`curiosity-view.${viewId}Subtitle`, {}, [
<Button
isInline
component="a"
variant="link"
target="_blank"
href="https://access.redhat.com/documentation/en-us/subscription_central/2020-04/html/getting_started_with_subscription_watch/con-how-does-subscriptionwatch-show-data_assembly-opening-subscriptionwatch-ctxt/"
/>
])}
</p>
)}
</RcsPageHeader>
Expand All @@ -44,15 +42,13 @@ const PageHeader = ({ children, t, viewId }) => (
*/
PageHeader.propTypes = {
children: PropTypes.node.isRequired,
t: PropTypes.func,
viewId: PropTypes.string
};

/**
* Default props.
*/
PageHeader.defaultProps = {
t: helpers.noopTranslate,
viewId: null
};

Expand Down

0 comments on commit 595c645

Please sign in to comment.