Skip to content

Commit

Permalink
Minor refactor, use Utils.renderContent instead of library
Browse files Browse the repository at this point in the history
  • Loading branch information
camillof authored and julianguyen committed Oct 22, 2024
1 parent 7de4a58 commit 21ff2e0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions client/app/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {
} from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBars, faTimes } from '@fortawesome/free-solid-svg-icons';
import renderHTML from 'react-render-html';
import { Utils } from 'utils';
import { I18n } from 'libs/i18n';
import { Logo } from 'components/Logo';
import { HeaderProfile } from 'components/Header/HeaderProfile';
Expand Down Expand Up @@ -106,7 +106,7 @@ export const Header = ({
<div id="headerMobile" className={css.headerMobileNav}>
<div>
{profile ? <HeaderProfile profile={profile} /> : null}
{mobileOnly ? renderHTML(mobileOnly) : null}
{mobileOnly ? Utils.renderContent(mobileOnly) : null}
{displayLinks()}
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions client/app/components/Input/InputCheckbox.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow
import React from 'react';
import type { Node } from 'react';
import renderHTML from 'react-render-html';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
import globalCss from 'styles/_global.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from 'components/Tooltip';
import type { Node } from 'react';
import React from 'react';
import globalCss from 'styles/_global.scss';
import { Utils } from 'utils';
import css from './Input.scss';
import type { Checkbox as Props } from './utils';

Expand Down Expand Up @@ -65,7 +65,7 @@ export const InputCheckbox = (props: Props): Node => {
&& displayUnchecked(name, uncheckedValue)}
{displayCheckbox(id, name, value, checked, onChange, label)}
<label className={`${css.checkboxLabel}`} htmlFor={id}>
{renderHTML(label)}
{Utils.renderContent(label)}
</label>
</div>
{displayInfo(info)}
Expand Down
10 changes: 5 additions & 5 deletions client/app/components/Input/InputSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import React, { useState } from 'react';
import type { Node } from 'react';
import renderHTML from 'react-render-html';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCaretDown } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import type { Node } from 'react';
import React, { useState } from 'react';
import { Utils } from 'utils';
import css from './Input.scss';
import type { Option } from './utils';

Expand Down Expand Up @@ -49,7 +49,7 @@ export function InputSelect({
>
{options.map((option: Option) => (
<option id={option.id} value={option.value} key={option.value}>
{renderHTML(option.label)}
{Utils.renderContent(option.label)}
</option>
))}
</select>
Expand Down
3 changes: 1 addition & 2 deletions client/app/widgets/Comments/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import React, { useState } from 'react';
import type { Node } from 'react';
import axios from 'axios';
import renderHTML from 'react-render-html';
import { I18n } from 'libs/i18n';
import { StoryBy } from 'components/Story/StoryBy';
import { StoryDate } from 'components/Story/StoryDate';
Expand Down Expand Up @@ -109,7 +108,7 @@ export const Comments = ({ comments, formProps }: Props): Node => {
const author = <a href={`/profile?uid=${commentByUid}`}>{commentByName}</a>;
return (
<article key={id} className={`comment ${css.comment}`}>
<div className={css.commentContent}>{renderHTML(comment)}</div>
<div className={css.commentContent}>{Utils.renderContent(comment)}</div>
<StoryDate date={createdAt} />
<div className={css.commentInfo}>
<StoryBy avatar={commentByAvatar} author={author} />
Expand Down
3 changes: 1 addition & 2 deletions client/app/widgets/Notifications/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import React, { useState, useEffect } from 'react';
import type { Node } from 'react';
import axios from 'axios';
import renderHTML from 'react-render-html';
import { I18n } from 'libs/i18n';
import Modal from 'components/Modal';
import { Utils } from 'utils';
Expand Down Expand Up @@ -82,7 +81,7 @@ export const Notifications = ({ element, pusher }: Props): Node => {

const displayNotifications = () => (
<div aria-live="polite">
{renderHTML(notifications)}
{Utils.renderContent(notifications)}
<button
type="button"
className="buttonDarkS smallMarginTop"
Expand Down

0 comments on commit 21ff2e0

Please sign in to comment.