Skip to content

Commit

Permalink
Merge pull request #972 from EnterpriseDB/feature/evan/cno-feedback-b…
Browse files Browse the repository at this point in the history
…utton

Feature/evan/cno feedback button

Former-commit-id: 22e5821
  • Loading branch information
epbarger authored Feb 22, 2021
2 parents 06340e6 + 3910734 commit cac3bf7
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/templates/learn-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@ const Tiles = ({ mode, mdx, navLinks, cardNavNodes }) => {
return null;
};

const EditButton = ({ githubEditLink }) => (
<a
href={githubEditLink || '#'}
className="btn btn-sm btn-primary px-4 text-nowrap"
>
Edit this page
</a>
);

const FeedbackButton = ({ githubIssuesLink }) => (
<a
href={githubIssuesLink + '&template=product-feedback.md&labels=feedback'}
target="_blank"
rel="noreferrer"
className="btn btn-sm btn-primary px-4 text-nowrap"
>
Feedback
</a>
);

const LearnDocTemplate = ({ data, pageContext }) => {
const { mdx } = data;
const { mtime, path, depth } = mdx.fields;
Expand Down Expand Up @@ -115,6 +135,14 @@ const LearnDocTemplate = ({ data, pageContext }) => {
}
).iconName;

// CNO isn't editable
// TODO unify docs/advo to share one smart component that knows what to show
const editOrFeedbackButton = path.includes('/cloud_native_operator/') ? (
<FeedbackButton githubIssuesLink={githubIssuesLink} />
) : (
<EditButton githubEditLink={githubEditLink} />
);

return (
<Layout pageMeta={pageMeta} katacodaPanelData={katacodaPanel}>
<TopBar />
Expand All @@ -131,12 +159,7 @@ const LearnDocTemplate = ({ data, pageContext }) => {
<MainContent>
<div className="d-flex justify-content-between align-items-center">
<h1 className="balance-text">{title}</h1>
<a
href={githubEditLink || '#'}
className="btn btn-sm btn-primary px-4 text-nowrap"
>
Edit this page
</a>
{editOrFeedbackButton}
</div>

<ContentRow>
Expand Down

0 comments on commit cac3bf7

Please sign in to comment.