Skip to content

Commit

Permalink
fix: 🐛 Add props definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Cem Derin committed Feb 6, 2020
1 parent 4bb4b60 commit 2f60dc9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ const StyledLi = styled.li`
text-decoration: ${(props:any) => props.active && !props.hideInactive ? "underline" : "none"};
`

const Item: React.FC = (props: any) => {
type ItemProps = {
hideInactive?: boolean,
active?: boolean,
toggleVisiblity?: Function
}

const Item: React.FC<ItemProps> = (props: any) => {
if(props.hideInactive && !props.active) return null;
if(props.hideInactive && props.active) return <StyledLi {...props} onClick={props.toggleVisiblity}/>
return <StyledLi {...props} />
Expand Down
6 changes: 5 additions & 1 deletion src/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const StyledUl = styled.ul`
padding: inherit;
`

const Menu: React.FC = (props: any) => {
type MenuProps = {
collapsed?: boolean
};

const Menu: React.FC<MenuProps> = (props: any) => {
const [displayCollapesList, setDisplayCollapesList] = useState(false);

const toggleVisibility = () => {
Expand Down

0 comments on commit 2f60dc9

Please sign in to comment.