Skip to content

Commit

Permalink
Update cms.js to use CSS Modules
Browse files Browse the repository at this point in the history
Includes removing an import of the prop type `number`, which wasn't being used anywhere.
Elected to only accept `heading` as a property in the `classes` prop as that is the only class that is going to be used. Even though there is a cms.css file in the same directory, it wasn't being used previously, therefore I don't know what its purpose is, so I'm just playing it safe and leaving the code base as unchanged from my direct change.
  • Loading branch information
luke-denton-aligent committed Feb 23, 2020
1 parent f940528 commit 24e0ea3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/venia-ui/lib/RootComponents/CMS/cms.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React, { Fragment } from 'react';
import { shape, string } from 'prop-types';
import { useQuery } from '@apollo/react-hooks';
import cmsPageQuery from '../../queries/getCmsPage.graphql';
import { fullPageLoadingIndicator } from '../../components/LoadingIndicator';
import RichContent from '../../components/RichContent';
import { number } from 'prop-types';
import CategoryList from '../../components/CategoryList';
import { Meta, Title } from '../../components/Head';
import { mergeClasses } from "../../classify";

import defaultClasses from './cms.css';

const CMSPage = props => {
const { id } = props;
const classes = mergeClasses(defaultClasses, props.classes);
const { loading, error, data } = useQuery(cmsPageQuery, {
variables: {
id: Number(id),
Expand All @@ -34,7 +38,7 @@ const CMSPage = props => {
const { content_heading, title } = data.cmsPage;

const headingElement = content_heading !== '' ? (
<h1 className="cms__content-heading">
<h1 className={classes.heading}>
{content_heading}
</h1>
) : null;
Expand Down Expand Up @@ -69,7 +73,10 @@ const CMSPage = props => {
};

CMSPage.propTypes = {
id: number
id: number,
classes: shape({
heading: string
})
};

export default CMSPage;

0 comments on commit 24e0ea3

Please # to comment.