Skip to content

Commit

Permalink
Add variants to Map Markers
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Maher committed Apr 27, 2017
1 parent 64c2b95 commit a8d2333
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
21 changes: 18 additions & 3 deletions components/Map/Markers/Marker.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.root {
width: 15rem;
background-color: var(--color-white);
color: var(--color-greyDarker);
border: none;
padding: 0;
border-radius: 4px;
Expand All @@ -18,7 +16,6 @@
height: 0;
position: absolute;
z-index: var(--z-tooltip);
border-color: var(--color-white);
border-left-color: transparent;
border-right-color: transparent;
border-bottom-color: transparent;
Expand All @@ -31,4 +28,22 @@
max-height: 350px;
overflow-y: auto;
overflow-x: hidden;
}

.root.light {
background-color: var(--color-white);
color: var(--color-greyDarker);
}

.root.light:before{
border-top-color: var(--color-white);
}

.root.dark {
background-color: var(--color-greyDarkest);
color: var(--color-white);
}

.root.dark:before {
border-top-color: var(--color-greyDarkest);
}
9 changes: 7 additions & 2 deletions components/Map/Markers/Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import cx from 'classnames';

import css from './Marker.css';

const Marker = ({ className, scrollClassName, children }) => (
<div className={ cx(css.root, className) }>
const Marker = ({ className, scrollClassName, children, variant }) => (
<div className={ cx(css.root, css[variant], className) }>
<div className={ cx(css.scrollContainer, scrollClassName) }>
{ children }
</div>
Expand All @@ -15,6 +15,11 @@ Marker.propTypes = {
className: PropTypes.string,
children: PropTypes.node.isRequired,
scrollClassName: PropTypes.string,
variant: PropTypes.oneOf(['light', 'dark']),
};

Marker.defaultProps = {
variant: 'light',
};

export default Marker;
20 changes: 20 additions & 0 deletions components/Map/Markers/Marker.story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { storiesOf } from '@kadira/storybook';

import Marker from './Marker';
import m from '../../../globals/modifiers.css';

storiesOf('Map Marker', module)
.add('Default (Light)', () => (
<Marker className={ m.paSmI }>
In association football, marking is an organized defensive strategy which aims to prevent a
member of the opposing team (usually a striker) from taking control of the ball.
</Marker>
))
.add('Dark', () => (
<Marker variant="dark" className={ m.paSmI }>
The terror it inspired... you have no idea, you’re too young. Just picture coming home and
finding the Dark Mark hovering over your house, and knowing what you’re about to find
inside... Everyone’s worst fear... the very worst.
</Marker>
));

0 comments on commit a8d2333

Please sign in to comment.