Skip to content

Commit f0e7acf

Browse files
authored
Merge pull request #1939 from fedspendingtransparency/banner
FDG-10877 Govt shutdown banner is missing ","
2 parents 1b2e39b + d893b13 commit f0e7acf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/components/markdown-transform/markdown-transform.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React from 'react';
2-
import { FunctionComponent } from 'react';
1+
import React, { FunctionComponent } from 'react';
32
import reactStringReplace from 'react-string-replace';
43
import reactElementToJSXString from 'react-element-to-jsx-string';
54
import ReactMarkdown from 'react-markdown';
@@ -8,19 +7,20 @@ import rehypeRaw from 'rehype-raw';
87

98
const replaceLinkTextWithLink = string => {
109
const regex = /(https?:\/\/[^\s]+)/g;
11-
return reactStringReplace(string, regex, (match, i) => {
10+
const stringArray = reactStringReplace(string, regex, (match, i) => {
1211
return reactElementToJSXString(<a href={match}>{match}</a>);
1312
});
13+
let stringOutput = '';
14+
stringArray.forEach(str => (stringOutput = stringOutput + str));
15+
return stringOutput;
1416
};
1517

1618
export const MarkdownTransform: FunctionComponent = ({ content, isBanner, customClass }) => {
1719
return (
1820
<>
1921
{isBanner ? (
2022
<ReactMarkdown
21-
children={replaceLinkTextWithLink(content)
22-
.toString()
23-
.replaceAll(/,/g, '')}
23+
children={replaceLinkTextWithLink(content)}
2424
components={{
2525
a: ({ children, href }) => {
2626
return <CustomLink url={href}>{children}</CustomLink>;

src/components/site-header/site-header.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { container, content, logo, stickyHeader } from './site-header.module.scs
1616
import { pxToNumber } from '../../helpers/styles-helper/styles-helper';
1717
import { breakpointLg } from '../../variables.module.scss';
1818
import { useRecoilValueLoadable } from 'recoil';
19-
import { dynamicBannerState, dynamicBannerLastCachedState } from '../../recoil/dynamicBannerState';
20-
import useShouldRefreshCachedData from "../../recoil/hooks/useShouldRefreshCachedData";
19+
import { dynamicBannerLastCachedState, dynamicBannerState } from '../../recoil/dynamicBannerState';
20+
import useShouldRefreshCachedData from '../../recoil/hooks/useShouldRefreshCachedData';
2121

2222
//Additional export for page width testability
2323
export const SiteHeader = ({ lowerEnvMsg, location, width }) => {

0 commit comments

Comments
 (0)