Skip to content

Instantly share code, notes, and snippets.

@tmeasday
Last active March 31, 2017 06:58
Show Gist options
  • Select an option

  • Save tmeasday/746c1944a6056593262b13d9bdb89cc1 to your computer and use it in GitHub Desktop.

Select an option

Save tmeasday/746c1944a6056593262b13d9bdb89cc1 to your computer and use it in GitHub Desktop.
Embedded Styles
import React, { Component, PropTypes } from 'react';
import styled from 'styled-components';
const AvatarDiv = styled.div`
border-radius: 0.2px;
border: 1px solid #eee;
`;
const BumpSpan = styled.span`
position: relative;
top: -10px;
`;
const Avatar = ({ name, avatar_url, onBump }) => (
<AvatarDiv>
<img src={avatar_url} title={name} />
<BumpSpan class="image-action" onClick={onBump}>Bump</BumpSpan>
</AvatarDiv>
);
Avatar.propTypes = {
name: PropTypes.string.isRequired,
avatar_url: PropTypes.string.isRequired,
onBump: PropTypes.func.isRequired,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment