Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
chore: lint check before commit for CI
Browse files Browse the repository at this point in the history
* fix: review changes
  • Loading branch information
phoenisx committed Nov 29, 2019
1 parent c286df3 commit 4f071ee
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 41 deletions.
14 changes: 14 additions & 0 deletions client/components/ProgressCardContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { CardContent, CircularProgress } from '@material-ui/core';

interface IProps {
loading: boolean;
}

const ProgressCardContent: React.FC<IProps> = props => (
<CardContent>
{props.loading ? <CircularProgress /> : props.children}
</CardContent>
);

export default ProgressCardContent;
3 changes: 2 additions & 1 deletion client/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SomeComponent from './SomeComponent';
import AddSponsor from './AddSponsor';
import ProgressCardContent from './ProgressCardContent';

export { SomeComponent, AddSponsor };
export { SomeComponent, AddSponsor, ProgressCardContent };
12 changes: 0 additions & 12 deletions client/interfaces/components/AddSponsor.tsx

This file was deleted.

7 changes: 7 additions & 0 deletions client/interfaces/models.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Here types are inherited from actual DB Modal Types
// created [here](types/models.d.ts)
// This is re

import { ISponsor } from 'types/models';

export type ISponsorResponse = Omit<ISponsor, 'createdAt' | 'updatedAt'>;
39 changes: 12 additions & 27 deletions client/modules/home.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import React, { useEffect } from 'react';
import {
Card,
CardContent,
Typography,
Grid,
CircularProgress,
} from '@material-ui/core';
import { Card, Typography, Grid } from '@material-ui/core';
import { makeStyles } from '@material-ui/styles';
import { useSelector, useDispatch } from 'react-redux';
import { SomeComponent } from 'client/components';
import { SomeComponent, ProgressCardContent } from 'client/components';
import { AppStoreState } from 'client/store/reducers';
import { chapterActions } from 'client/store/actions';

Expand All @@ -18,24 +12,6 @@ const useStyles = makeStyles(() => ({
},
}));

const renderCardContent = (loading, name, description) => {
return (
<CardContent>
{!loading && (
<>
<Typography gutterBottom variant="h5" component="h2">
{name}
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
{description}
</Typography>
</>
)}
{loading && <CircularProgress />}
</CardContent>
);
};

const Home: React.FC = () => {
const classes = useStyles();

Expand All @@ -59,7 +35,16 @@ const Home: React.FC = () => {
<Grid container className={classes.root} spacing={2}>
<Grid item xs={10}>
{!error && (
<Card>{renderCardContent(loading, name, description)}</Card>
<Card>
<ProgressCardContent loading={loading}>
<Typography gutterBottom variant="h5" component="h2">
{name}
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
{description}
</Typography>
</ProgressCardContent>
</Card>
)}
</Grid>
</Grid>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged",
"pre-push": "npm run lint"
}
},
"jest": {
Expand Down

0 comments on commit 4f071ee

Please sign in to comment.