Skip to content

Commit

Permalink
added banner component (#75)
Browse files Browse the repository at this point in the history
* added banner component

* trigger new now preview build

* export banner component

* code review fixes

* exported also subscribe component
  • Loading branch information
aniri authored Mar 21, 2020
1 parent d0fa574 commit 94cb9ce
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![GitHub contributors](https://img.shields.io/github/contributors/code4romania/taskforce-fe-components.svg?style=for-the-badge)](https://github.com/code4romania/taskforce-fe-components/graphs/contributors) [![GitHub last commit](https://img.shields.io/github/last-commit/code4romania/taskforce-fe-components.svg?style=for-the-badge)](https://github.com/code4romania/taskforce-fe-components/commits/master) [![License: MPL 2.0](https://img.shields.io/badge/license-MPL%202.0-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/MPL-2.0)

A set of reusable components between taskforce react apps.
A set of reusable components between taskforce react apps.

[Contributing](#contributing) | [Built with](#built-with) | [Deployment](#deployment) | [Feedback](#feedback) | [License](#license) | [About Code4Ro](#about-code4ro)

Expand Down
31 changes: 31 additions & 0 deletions src/components/banner/banner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import PropTypes from "prop-types";
import "./banner.scss";

export const Banner = ({ color, title, link }) => {
return (
<div className={`banner-wrapper is-${color}`}>
<div className="banner">
<div className="title">
<a
href="${link}"
target="_blank"
rel="noopener noreferrer"
>
{title || ""}
</a>
</div>
</div>
</div>
);
};

Banner.propTypes = {
color: PropTypes.oneOf(["red", "pink", "green", "yellow"]),
title: PropTypes.string.isRequired,
link: PropTypes.string.isRequired
};

Banner.defaultProps = {
color: 'yellow'
};
41 changes: 41 additions & 0 deletions src/components/banner/banner.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@import "~bulma/sass/utilities/_all.sass";

$info-card-colors: (
'red': #FF1616,
'pink': #F5BCD6,
'green': #05D6C7,
'yellow': #FFDE59);

.banner-wrapper {
width: 100%;
}

.banner {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
min-height:50px;
}

.title {
width: 100%;
display: flex;
justify-content: center;

a {
font-size: 1rem;
font-weight: 400;
color: #000;
text-decoration: underline;

}
}

@each $color-name, $color-value in $info-card-colors{
&.is-#{$color-name} {
.banner{
background-color: $color-value;
}
}
}
18 changes: 18 additions & 0 deletions src/components/banner/banner.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import { Banner } from "./banner";

import "./../../styles.scss";

export default { title: "Banner" };

export const defaultColor = () => (
<Banner title="15 RECOMANDĂRI privind conduita socială responsabilă în prevenirea răspândirii coronavirus. " link="https://code4.ro" />
);

export const green = () => (
<Banner color="green" title="15 RECOMANDĂRI privind conduita socială responsabilă în prevenirea răspândirii coronavirus. " link="https://code4.ro" />
);

export const yellow = () => (
<Banner color="yellow" title="15 RECOMANDĂRI privind conduita socială responsabilă în prevenirea răspândirii coronavirus. " link="https://code4.ro" />
);
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export * from "./components/hero/hero";

export * from "./components/incubated-by/incubated-by";

export * from "./components/banner/banner";

export * from "./components/instruments/instruments";
export * from "./components/instruments-item/instruments-item";

Expand All @@ -30,3 +32,6 @@ export * from "./components/logo/logo";

export * from "./components/search-input/search-input";
export * from "./components/social-share/social-share";

export * from "./components/subscribe/mailchimp-subscribe";
export * from "./components/subscribe/subscribe-form";

0 comments on commit 94cb9ce

Please sign in to comment.