Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(container): add missing interface for list pattenr
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Küchler committed Dec 13, 2017
1 parent 5fc7f79 commit d9238c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
8 changes: 2 additions & 6 deletions src/component/container/pattern_list.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import Input from '../../lsg/patterns/input/';
import { PatternFolder } from '../../store/pattern/folder';
// import { Headline } from '../../lsg/patterns/headline';
import List, { Label, Li, ListItemProps, Ul, Value } from '../../lsg/patterns/list';
import { action } from 'mobx';
import { observer } from 'mobx-react';
import { PageElement } from '../../store/page/page_element';
import { Pattern } from '../../store/pattern';
// import PatternListItem from '../../lsg/patterns/pattern-list-item';
import * as React from 'react';
import { Store } from '../../store';

Expand Down Expand Up @@ -39,9 +37,7 @@ export class PatternList extends React.Component<PatternListProps> {
return (
<div>
<Input handleChange={this.handleSearchInputChange} />
<List headline="Patterns">
{list}
</List>
<List headline="Patterns">{list}</List>
</div>
);
}
Expand Down Expand Up @@ -83,7 +79,7 @@ export class PatternList extends React.Component<PatternListProps> {
return (
<Li
draggable={props.draggable}
onDragStart={props.handleDragStart}
handleDragStart={props.handleDragStart}
key={index}
active={props.active}
onClick={props.onClick}
Expand Down
2 changes: 1 addition & 1 deletion src/component/container/project_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ProjectList extends React.Component<ProjectListProps> {
return (
<Li
draggable={props.draggable}
onDragStart={props.handleDragStart}
handleDragStart={props.handleDragStart}
key={index}
active={props.active}
onClick={props.onClick}
Expand Down
40 changes: 18 additions & 22 deletions src/lsg/patterns/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ interface StyledListItemProps {
draggable?: boolean;
}

export interface LiProps {
active?: boolean;
draggable?: boolean;

onClick?: React.MouseEventHandler<HTMLElement>;
handleDragStart?: React.DragEventHandler<HTMLElement>;
}

const StyledUl = styledComponents.ul`
box-sizing: border-box;
padding: 0 0 0 15px;
Expand All @@ -46,47 +54,35 @@ const StyledLabel = styledComponents.span`
padding-right 4px;
`;

const StyledValue = styledComponents.span`
const StyledValue = styledComponents.span`
color: ${colors.black.toString()};
`;

export class Ul extends React.Component<{}> {
public render(): JSX.Element {
return (
<StyledUl>
{this.props.children}
</StyledUl>
);
return <StyledUl>{this.props.children}</StyledUl>;
}
}

export class Li extends React.Component<{}> {
export class Li extends React.Component<LiProps> {
public constructor(props: LiProps) {
super(props);
}

public render(): JSX.Element {
return (
<StyledLi>
{this.props.children}
</StyledLi>
);
return <StyledLi {...this.props}>{this.props.children}</StyledLi>;
}
}

export class Label extends React.Component<{}> {
public render(): JSX.Element {
return (
<StyledLabel>
{this.props.children}
</StyledLabel>
);
return <StyledLabel>{this.props.children}</StyledLabel>;
}
}

export class Value extends React.Component<{}> {
public render(): JSX.Element {
return (
<StyledValue>
{this.props.children}
</StyledValue>
);
return <StyledValue>{this.props.children}</StyledValue>;
}
}

Expand Down

0 comments on commit d9238c8

Please sign in to comment.