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

Issue 72 online presence icons and links #90

Merged
merged 9 commits into from
Mar 3, 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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Replace
"teamMembers": [
{ "name": "Example Member1", "link": "https://github.com/examplemember1" },
{ "name": "Example Member2", "link": "https://github.com/examplemember2" }
],
"socialLinks": [
{ "name": "medium", "link": "https://medium.com/" },
{ "name": "github", "link": "https://github.com/" }
]
},
"products": [
Expand Down Expand Up @@ -85,6 +89,7 @@ Replace
| `proxyURL` | CORS proxy url. Required for Medium API access E.g. https://github.com/c-hive/cors-proxy | `string / url` | **No** |
| `header.technologies` | Technologies used by team/user/company. | `array` | **No** |
| `header.teamMembers` | Team member(s) name and link. | `object` | **No** |
| `header.socialLinks` | Team online presence. | `object` | **No** |
| `products.name` | Product name. (This is required if you create a product entry) | `string` | **Yes** |
| `products.cover` | Product cover image. | `string / path to img` | **No** |
| `products.description` | Product description | `string` | **No** |
Expand Down
11 changes: 11 additions & 0 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import settings from "../../../settings/settings.json";
import {
headerStyle,
headerIconsContainerStyle,
socialIconsWrapperStyle,
logoTextStyle,
logoStyle,
} from "./Header.style";
import ToggleButton from "./ToggleButton/ToggleButton";
import TechIcons from "./TechIcons/TechIcons";
import TechNames from "./TechNames/TechNames";
import TeamMembers from "./TeamMembers/TeamMembers";
import SocialIcons from "../UI/SocialIcons/SocialIcons";

const Header = styled.div`
${headerStyle}
Expand All @@ -20,6 +22,10 @@ const HeaderIconsContainer = styled.div`
${headerIconsContainerStyle}
`;

const SocialIconsWrapper = styled.div`
${socialIconsWrapperStyle}
`;

const LogoText = styled.p`
${logoTextStyle}
`;
Expand All @@ -37,6 +43,11 @@ const header = () => (
<HeaderIconsContainer>
{settings.display === "icon" ? <TechIcons /> : <TechNames />}
{settings.header.teamMembers ? <TeamMembers /> : null}
{settings.socialIcons && (
<SocialIconsWrapper>
<SocialIcons links={settings.header.socialLinks} />
</SocialIconsWrapper>
)}
</HeaderIconsContainer>
) : null}
</Header>
Expand Down
10 changes: 9 additions & 1 deletion src/components/Header/Header.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const headerIconsContainerStyle = css`
align-items: center;
flex-basis: 100%;
width: 100%;
margin: 0px 0 10px 20px;
margin: 0px 20px 10px 20px;

.border {
border-left: 1px solid ${props => props.theme.color};
Expand All @@ -16,6 +16,14 @@ export const headerIconsContainerStyle = css`
}
`;

export const socialIconsWrapperStyle = css`
margin-left: auto;

.MuiIconButton-root {
margin-right: 4px;
}
`;

export const headerStyle = css`
display: flex;
flex-wrap: wrap;
Expand Down
33 changes: 3 additions & 30 deletions src/components/Products/Product/Product.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React from "react";
import styled from "styled-components";
import {
Card,
CardActions,
CardContent,
CardMedia,
IconButton,
} from "@material-ui/core/";
import { Card, CardActions, CardContent, CardMedia } from "@material-ui/core/";
import {
productStyle,
productTitleStyle,
Expand All @@ -15,6 +9,7 @@ import {
} from "./Product.style";
import IconDisplayer from "../../UI/Icons/IconDisplayer";
import settings from "../../../../settings/settings";
import SocialIcons from "../../UI/SocialIcons/SocialIcons";

const Product = styled.div`
${productStyle}
Expand Down Expand Up @@ -64,29 +59,7 @@ const product = ({ name, cover, description, technologies, socialLinks }) => {
{socialLinks && (
<CardActions>
<ActionTechIcons className="action__techIcons">
{socialLinks.map(social =>
settings.socialIcons[social.name] ? (
<IconButton
key={social.name}
href={social.link}
aria-label={social.name}
size="small"
target="_blank"
rel="noopener noreferrer"
>
<IconDisplayer
key={social.name}
name={settings.socialIcons[social.name].name}
src={settings.socialIcons[social.name].icon}
/>
</IconButton>
) : (
/* eslint-disable-next-line no-console */
console.warn(
`There is no icon path specified in the settings for ${social.name} social icon`
)
)
)}
<SocialIcons links={socialLinks} />
</ActionTechIcons>
</CardActions>
)}
Expand Down
4 changes: 0 additions & 4 deletions src/components/Products/Product/Product.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ export const technologiesIconsContainerStyle = css`
`;

export const actionTechIconsStyle = css`
a {
display: inline-block;
}

img {
width: 28px;
height: 28px;
Expand Down
42 changes: 42 additions & 0 deletions src/components/UI/SocialIcons/SocialIcons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import styled from "styled-components";
import { IconButton } from "@material-ui/core/";
import { socialIconsStyle } from "./SocialIcons.style";
import IconDisplayer from "../Icons/IconDisplayer";
import settings from "../../../../settings/settings";

const SocialIcons = styled.div`
${socialIconsStyle}
`;

const socialIcons = ({ links }) => {
return (
<SocialIcons>
{links.map(social =>
settings.socialIcons[social.name] ? (
<IconButton
key={social.name}
href={social.link}
aria-label={social.name}
size="small"
target="_blank"
rel="noopener noreferrer"
>
<IconDisplayer
key={social.name}
name={settings.socialIcons[social.name].name}
src={settings.socialIcons[social.name].icon}
/>
</IconButton>
) : (
/* eslint-disable-next-line no-console */
console.warn(
`There is no icon path specified in the settings for ${social.name} social icon`
)
)
)}
</SocialIcons>
);
};

export default socialIcons;
7 changes: 7 additions & 0 deletions src/components/UI/SocialIcons/SocialIcons.style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { css } from "styled-components";

export const socialIconsStyle = css`
a {
display: inline-block;
}
`;