Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the card component to follow the new design #294

Merged
merged 4 commits into from
Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions my-app/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="stylesheet" href="src/index.css" />
2 changes: 1 addition & 1 deletion my-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook"
"storybook": "start-storybook -s public, src"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
28 changes: 0 additions & 28 deletions my-app/src/components/Card/Card.css

This file was deleted.

39 changes: 0 additions & 39 deletions my-app/src/components/Card/Card.js

This file was deleted.

3 changes: 3 additions & 0 deletions my-app/src/components/Input/Input.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
input {
font-size: 1.6rem;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import './avatar.css';
import avatarPhoto from './avatar.jpg';
import React from "react";
import "./avatar.css";
import avatarPhoto from "./avatar.jpg";

const Avatar = () => {
return (
<div>
<div className="avatar">
<img src={avatarPhoto} alt="avatar" className="avatar-img" />
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions my-app/src/components/avatar/avatar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.avatar-img {
border-radius: 50%;
margin-top: 1em;
width: 7rem;
height: 6rem;
width: 6rem;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import './Input.css';
import React from "react";
import "./input.css";

const Input = ({ type, name }) => {
return <input type={type} name={name}></input>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import './link.css';
import React from "react";
import "./link.css";
diwanow marked this conversation as resolved.
Show resolved Hide resolved

const Link = ({ link, text }) => {
return (
Expand Down
13 changes: 6 additions & 7 deletions my-app/src/components/link/link.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.contact-link{
font-family: 'Roboto', sans-serif;
font-style: normal;
font-size: 1em;
font-weight: 500;
text-decoration-line: underline;
.contact-link {
cecastosic marked this conversation as resolved.
Show resolved Hide resolved
font-style: normal;
font-size: 1.6rem;
font-weight: 500;
text-decoration-line: underline;
}

a {
color: #3B4349;
color: #3b4349;
}
6 changes: 0 additions & 6 deletions my-app/src/components/name/Name.css

This file was deleted.

12 changes: 0 additions & 12 deletions my-app/src/components/name/Name.js

This file was deleted.

3 changes: 3 additions & 0 deletions my-app/src/components/sampleButton/button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
button {
font-size: 1.6rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// how you can make your component in storybook. <-----

// Import react, css and other files if needed
import React from 'react';
import React from "react";
cecastosic marked this conversation as resolved.
Show resolved Hide resolved
import "./button.css";

const SampleButton = () => {
return <button>Sample button</button>;
Expand Down
8 changes: 0 additions & 8 deletions my-app/src/components/skill/Skill.component.js

This file was deleted.

14 changes: 0 additions & 14 deletions my-app/src/components/skill/Skill.css

This file was deleted.

67 changes: 67 additions & 0 deletions my-app/src/components/userCard/user-card.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from "react";
import PropTypes from "prop-types";
import "./user-card.css";
import Avatar from "../avatar/avatar.component";
import UserCardSection from "../userCardSection/user-card-section.component";

const Name = ({ name }) => {
return (
<div className="name">
<h5>{name}</h5>
</div>
);
};

const Role = ({ mentor, mentee }) => {
return (
<div className="role">
<h6>
{mentor && mentee ? (
<>
<span>Mentor</span> /<span> Mentee</span>
</>
) : mentee ? (
<span>Mentee</span>
) : (
<span>Mentor</span>
)}
</h6>
</div>
);
};

function getClassName(user) {
const classes = ["card"];
user.mentor && classes.push("mentor");
user.mentee && classes.push("mentee");
return classes.join(" ");
}

const UserCard = ({ user, sections }) => {
const { name, mentor, mentee } = user;
return (
<div className={getClassName(user)}>
<div className={sections.length > 1 ? "extended content" : "content"}>
{}
<Avatar />
<Name name={name} />
<Role mentor={mentor} mentee={mentee} />
{sections.length > 0 &&
sections.map((article, index) => (
<UserCardSection
key={index}
title={article.title}
text={article.text}
/>
))}
</div>
</div>
);
};

UserCard.propTypes = {
user: PropTypes.object.isRequired,
sections: PropTypes.array.isRequired
};

export default UserCard;
64 changes: 64 additions & 0 deletions my-app/src/components/userCard/user-card.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.card {
align-items: center;
background-color: #fea594;
color: #3b4349;
display: flex;
flex-direction: column;
margin: 6rem;
padding: 1.3rem;
text-align: left;
width: 32rem;
}

.card.mentee {
background-color: #e32c6a;
}

.card.mentor-mentee {
background: linear-gradient(
135deg,
rgba(227, 43, 105, 1) 0%,
rgba(248, 194, 161, 1) 100%
);
}

.card .content {
background-color: #fff;
margin: 0 1.6rem;
padding: 1.2rem 2.4rem 0.4rem;
position: relative;
width: 29.2rem;
}

.card .avatar {
position: absolute;
left: 40%;
transform: translateX(-40%);
transform: translateY(-60%);
top: 0;
}

.card .extended .name,
.card .extended .role {
text-align: center;
}

.card .extended .role + .card-section {
border-top: none;
}

.card .name h5 {
padding: 1.2rem 0 0;
}

.card .role h6 {
color: #fd4927;
font-size: 1.6rem;
font-weight: 300;
margin: 0.8rem 0;
text-transform: uppercase;
}

.card .role h6 span {
font-size: 1.6rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react";
import "./user-card-section.css";

const UserCardSection = ({ title, text }) => {
return (
<section className="user-card">
<h6>{title}</h6>
<p>{text}</p>
</section>
);
};

export default UserCardSection;
9 changes: 9 additions & 0 deletions my-app/src/components/userCardSection/user-card-section.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.user-card {
border-top: 1px solid rgba(253, 73, 39, 0.5);
margin: 1.2rem 0;
padding-top: 1.2rem;
}

.user-card h6 {
margin-bottom: 0.3rem;
}
Loading