Skip to content

Instantly share code, notes, and snippets.

@codemilli
Created February 12, 2016 14:37
Show Gist options
  • Save codemilli/2285437d71559bc3f46b to your computer and use it in GitHub Desktop.
Save codemilli/2285437d71559bc3f46b to your computer and use it in GitHub Desktop.
visible option 을 선택하는 header component
import React, { PropTypes } from 'react';
/**
* Define React Presentational Component Header
*/
const Header = ({visible, setVisible}) => {
const getStyle = (type) => {
if (visible === type) {
return {
textDecoration: 'underline'
};
}
return {
textDecoration: 'none'
};
};
return (
<div>
<a onClick={() => setVisible('SHOW_ALL')} style={getStyle('SHOW_ALL')}>ALL</a> -
<a onClick={() => setVisible('SHOW_COMPLETED')} style={getStyle('SHOW_COMPLETED')}> COMPLETED</a> -
<a onClick={() => setVisible('SHOW_UNCOMPLETED')} style={getStyle('SHOW_UNCOMPLETED')}> UNCOMPLETED</a>
</div>
);
};
export default Header;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment