Skip to content
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
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ See [featuredLogos](https://github.com/FormidableLabs/formidable-oss-badges/tree
- `urql`
- `victory`
- `nuka`
- `owl`

### Additional props

| Prop | Type | Description | Default |
| ----------- | ------- | ------------------------ | ------- |
| className | String | Additional class names | `''` |
| isHoverable | Boolean | Add hover style effects | `false` |
| small | Boolean | Small badge w/ icon only | `false` |

## IconBadge

Expand Down Expand Up @@ -126,7 +135,6 @@ ProjectBadge with svg child:

### IconBadge Usage


**Example 4**:

```jsx
Expand Down Expand Up @@ -173,7 +181,6 @@ You can then edit `examples/src/App.js`, either by returning the components dire

Note that this array is currently just used for passing _props_ into `<ProjectBadge />` and not for passing children or for rendering `<IconBadge />`.


## Maintenance Status

**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
Expand Down
10 changes: 5 additions & 5 deletions examples/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ const App = () => (
<p>Example of IconBadge using a png</p>
</div>
<div className="badge-container">
<ProjectBadge
abbreviation="R"
description="React"
color="#FFFFFF"
>
<ProjectBadge abbreviation="R" description="React" color="#FFFFFF">
<image
width="70%"
height="70%"
Expand Down Expand Up @@ -93,6 +89,10 @@ const App = () => (
<FeaturedBadge isHoverable name="nuka"></FeaturedBadge>
<p>Nuka ProjectBadge</p>
</div>
<div className="badge-container">
<FeaturedBadge isHoverable name="owl"></FeaturedBadge>
<p>React Native Owl ProjectBadge</p>
</div>
</div>
);

Expand Down
9 changes: 7 additions & 2 deletions src/FeaturedBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import React from "react";
import PropTypes from "prop-types";
import styled from "styled-components";
import featuredLogos from "./assets/featuredLogos";
import smallLogos from "./assets/smallLogos";

const FeaturedBadge = ({ name, className, isHoverable }) => {
const Logo = featuredLogos[name.toLowerCase()];
const FeaturedBadge = ({ name, className, isHoverable, small }) => {
const Logo = small
? smallLogos[name.toLowerCase()]
: featuredLogos[name.toLowerCase()];
if (!Logo) return null;
const StyledLogo = styled(({ isHoverable, ...rest }) => <Logo {...rest} />)`
${({ isHoverable }) =>
Expand Down Expand Up @@ -38,11 +41,13 @@ FeaturedBadge.propTypes = {
},
className: PropTypes.string,
isHoverable: PropTypes.bool,
small: PropTypes.bool,
};

FeaturedBadge.defaultProps = {
className: "",
isHoverable: false,
small: false,
};

export default FeaturedBadge;
4 changes: 3 additions & 1 deletion src/assets/featuredLogos/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import victory from "./victory.svg";
import spectacle from "./spectacle.svg";
import urql from "./urql.svg";
import nuka from "./nuka.svg";
import owl from "./owl.svg";

export default {
renature,
victory,
spectacle,
urql,
nuka
nuka,
owl,
};
47 changes: 1 addition & 46 deletions src/assets/featuredLogos/nuka.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/featuredLogos/owl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading