Skip to content

Commit f160f9e

Browse files
committed
Add Hover Effect to Cards
1 parent 0746e2b commit f160f9e

5 files changed

Lines changed: 85 additions & 45 deletions

File tree

app/components/Applications.tsx

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { makeStyles } from '@material-ui/core/styles';
1313
import { DashboardContext } from '../context/DashboardContext';
1414

1515
import ServicesModal from '../modals/ServicesModal';
16+
import '../stylesheets/Applications.css';
1617

1718
const Applications = () => {
1819
const { applications, getApplications, deleteApp } = useContext(DashboardContext);
@@ -44,14 +45,15 @@ const Applications = () => {
4445
color: 'white',
4546
fontSize: '3rem',
4647
whiteSpace: 'nowrap',
47-
background: 'rgb(33, 34, 41)',
48+
backgroundColor: '#24262f',
4849
border: '2px solid black',
4950
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
5051
'&:hover, &.Mui-focusVisible': { background: 'rgba(33, 34, 41, 0.75)' },
5152
},
5253
hover: {
5354
color: 'white',
5455
boxShadow: 'none',
56+
'&:hover, &.Mui-focusVisible': { color: 'red' },
5557
},
5658
btnStyle: {
5759
position: 'relative',
@@ -68,28 +70,31 @@ const Applications = () => {
6870
<>
6971
{applications.map((app: string, i: number | any | string | undefined) => (
7072
<Grid item xs={6} key={i}>
71-
<Card
72-
className={classes.paper}
73-
variant="outlined"
74-
onClick={(event: React.MouseEvent<HTMLElement>) => handleClick(app, i)}
75-
>
76-
<CardHeader
77-
avatar={
78-
<IconButton
79-
className={classes.hover}
80-
aria-label="Delete"
81-
onClick={(event: React.MouseEvent<HTMLElement>) => confirmDelete(app, i)}
82-
>
83-
<DeleteForeverOutlinedIcon />
84-
</IconButton>
85-
}
86-
></CardHeader>
87-
<CardContent>
88-
<Typography variant="h2">{app}</Typography>
89-
</CardContent>
90-
</Card>
73+
<div id="card-hover">
74+
<Card
75+
className={classes.paper}
76+
variant="outlined"
77+
onClick={(event: React.MouseEvent<HTMLElement>) => handleClick(app, i)}
78+
>
79+
<CardHeader
80+
avatar={
81+
<IconButton
82+
className={classes.hover}
83+
aria-label="Delete"
84+
onClick={(event: React.MouseEvent<HTMLElement>) => confirmDelete(app, i)}
85+
>
86+
<DeleteForeverOutlinedIcon />
87+
</IconButton>
88+
}
89+
></CardHeader>
90+
<CardContent>
91+
<Typography variant="h2">{app}</Typography>
92+
</CardContent>
93+
</Card>
94+
</div>
9195
</Grid>
9296
))}
97+
9398
<Modal open={open} onClose={() => setOpen(false)}>
9499
<ServicesModal i={index} app={app} />
95100
</Modal>
@@ -98,3 +103,5 @@ const Applications = () => {
98103
};
99104

100105
export default Applications;
106+
107+
//name, desc, creation date

app/components/Occupied.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import AddCircleOutlineTwoToneIcon from '@material-ui/icons/AddCircleOutlineTwoT
55

66
import AddModal from '../modals/AddModal';
77
import Applications from './Applications';
8-
// import '../stylesheets/Occupied.css';
98

109
const Occupied: React.FC = () => {
1110
const [open, setOpen] = useState(false);
@@ -15,7 +14,7 @@ const Occupied: React.FC = () => {
1514
color: theme.palette.text.secondary,
1615
height: 340,
1716
width: '100%',
18-
background: 'rgb(33, 34, 41)',
17+
backgroundColor: '#24262f',
1918
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
2019
'&:hover, &.Mui-focusVisible': {
2120
backgroundColor: 'rgba(33, 34, 41, 0.75)',
@@ -34,6 +33,8 @@ const Occupied: React.FC = () => {
3433
'&:hover, &.Mui-focusVisible': { color: 'rgb(255, 243, 72)' },
3534
},
3635
heroContent: {
36+
fontWeight: 700,
37+
color: '#333',
3738
padding: theme.spacing(8, 0, 6),
3839
backgroundColor: '#e8e8e8',
3940
},
@@ -42,10 +43,10 @@ const Occupied: React.FC = () => {
4243
const classes = useStyles();
4344

4445
return (
45-
<div>
46+
<>
4647
<Typography
4748
className={classes.heroContent}
48-
variant="h1"
49+
variant="h2"
4950
align="center"
5051
color="textPrimary"
5152
gutterBottom
@@ -64,7 +65,7 @@ const Occupied: React.FC = () => {
6465
</Grid>
6566
<Applications />
6667
</Grid>
67-
</div>
68+
</>
6869
);
6970
};
7071

app/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,17 @@ import React from 'react';
22
import ReactDOM from 'react-dom';
33
import './stylesheets/index.scss';
44
import App from './App';
5+
import { createMuiTheme, ThemeProvider } from '@material-ui/core';
56

6-
ReactDOM.render(<App />, document.getElementById('app'));
7+
const theme = createMuiTheme({
8+
typography: {
9+
fontFamily: ['Nunito sans', 'sans-serif'].join(','),
10+
},
11+
});
12+
13+
ReactDOM.render(
14+
<ThemeProvider theme={theme}>
15+
<App />
16+
</ThemeProvider>,
17+
document.getElementById('app')
18+
);

app/stylesheets/Applications.css

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
.app-btn {
2-
width: 80%;
3-
height: 50px;
4-
background-color: #24262F;
5-
padding: 2%;
6-
margin: 10px 0 10px 0;
7-
font-size: 2.5vh;
8-
border: none;
9-
text-align: center;
10-
color: white;
11-
transition: 0.1s;
12-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
13-
}
14-
15-
.app-btn:hover {
1+
#card-hover {
162
cursor: pointer;
17-
background-color: #494FEE;
18-
}
3+
position: relative;
4+
font-size: 28px;
5+
border-top-right-radius: 10px;
6+
border-bottom-left-radius: 10px;
7+
transition: all 1s;
8+
&:after,
9+
&:before {
10+
content: ' ';
11+
width: 10px;
12+
height: 10px;
13+
position: absolute;
14+
border: 0px solid #fff;
15+
transition: all 1s;
16+
}
17+
&:after {
18+
top: -1px;
19+
left: -1px;
20+
border-top: 5px solid black;
21+
border-left: 5px solid black;
22+
}
23+
&:before {
24+
bottom: -1px;
25+
right: -1px;
26+
border-bottom: 5px solid black;
27+
border-right: 5px solid black;
28+
}
29+
&:hover {
30+
border-top-right-radius: 0px;
31+
border-bottom-left-radius: 0px;
32+
&:before,
33+
&:after {
34+
width: 100%;
35+
height: 100%;
36+
}
37+
}
38+
}

app/stylesheets/Home.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import './constants.scss';
22

33
.home {
4-
background-color: #f4f4f4;
4+
background-color: #f2f2f2;
55
height: 100%;
66
display: flex;
77
align-items: center;

0 commit comments

Comments
 (0)