Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit 2bc9079

Browse files
add responsive standfor page to show fullly aligned contents on md and sm screens. (#47)
* add responsive standforpage, to show fully aligned content on medium and smaller screens * minor css change
1 parent fdf9998 commit 2bc9079

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

src/components/AboutCard/MainCard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { Typography, makeStyles, Container, Hidden } from '@material-ui/core';
3+
import { Typography, makeStyles, Container } from '@material-ui/core';
44
import SubCard from './SubCard';
55

66
const useStyles = makeStyles(theme => ({
@@ -25,11 +25,11 @@ function MainCard({ content, ...props }) {
2525
<Typography variant="subtitle1" className={classes.content}>
2626
{content.about}
2727
</Typography>
28-
<Hidden smDown>
28+
<>
2929
{content.points.map(point => (
3030
<SubCard key={point.id} point={point} />
3131
))}
32-
</Hidden>
32+
</>
3333
</Container>
3434
);
3535
}

src/components/AboutCard/SubCard.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
import React from 'react';
2-
import { Grid, Typography, makeStyles, Box } from '@material-ui/core';
2+
import { Grid, Typography, makeStyles, Box, Hidden } from '@material-ui/core';
33

4-
const useStyles = makeStyles(theme => ({
4+
const useStyles = makeStyles((theme) => ({
55
root: {
66
padding: 0,
7-
paddingTop: '40px'
7+
paddingTop: '40px',
8+
textAlign: 'center'
89
},
910

10-
extraMargin: {
11+
title: {
1112
marginLeft: 15,
13+
float: 'right',
1214
[theme.breakpoints.down('md')]: {
1315
marginLeft: 25
16+
},
17+
[theme.breakpoints.down('xs')]: {
18+
margin: '0 auto',
19+
float: 'none',
20+
textAlign: 'center',
21+
}
22+
},
23+
contentTitle: {
24+
fontWeight: 'bold',
25+
[theme.breakpoints.down('xs')]: {
26+
fontWeight: 'normal'
27+
}
28+
},
29+
image: {
30+
margin: '10px auto',
31+
display: 'inline-block',
32+
float: 'left',
33+
[theme.breakpoints.down('xs')]: {
34+
float: 'none',
1435
}
1536
}
1637
}));
@@ -19,18 +40,20 @@ const SubCard = ({ point }) => {
1940
const classes = useStyles();
2041
return (
2142
<Grid container className={classes.root}>
22-
<Grid item md={2}>
43+
<Grid className={classes.image} item sm={2} xs={12}>
2344
<img alt="title-img" style={{ marginTop: '6px' }} height="55px" src={point.img} />
2445
</Grid>
25-
<Grid item md={10}>
26-
46+
<Grid item sm={10} xs={12}>
2747
<Typography
28-
className={classes.extraMargin}
48+
className={classes.title}
49+
align="justify"
2950
variant="subtitle1"
3051
>
31-
<Box component="span" style={{ fontWeight: 'bold' }} display="inline-block">{`${point.contentTitle} :`}</Box>
32-
{` `}
33-
{point.content}
52+
<Box component="span" className={classes.contentTitle} display="inline-block">{`${ point.contentTitle }`}</Box>
53+
54+
<Hidden xsDown>
55+
<strong> : </strong>{ point.content }
56+
</Hidden>
3457
</Typography>
3558
</Grid>
3659
</Grid>

src/views/pages/HomeView/MainCards.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ function MainCards({ className, ...rest }) {
2121
return (
2222
<Container className={clsx(classes.root, className)} {...rest}>
2323
<Grid alignItems="center" container justify="center" spacing={8}>
24-
<Grid item md={6} sm={6} xs={12}>
24+
<Grid item md={6} xs={12}>
2525
<MainCard content={openKnowledgeContent} />
2626
</Grid>
27-
<Grid item md={6} sm={6} xs={12}>
27+
<Grid item md={6} xs={12}>
2828
<MainCard content={openSourceContent} />
2929
</Grid>
3030
</Grid>

0 commit comments

Comments
 (0)