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

Commit

Permalink
feat(lsg): new styling for pattern pane
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Frick committed Dec 19, 2017
1 parent 8ccd305 commit 19b411e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/component/container/pattern_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class PatternListContainer extends React.Component<PatternListContainerPr
return (
<div>
<Space sizeBottom={Size.L}>
<Input handleChange={this.handleSearchInputChange} placeholder="Search" />
<Input handleChange={this.handleSearchInputChange} placeholder="Search patterns" />
</Space>
<Space sizeBottom={Size.L}>{list}</Space>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/lsg/patterns/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export interface IconProps {

export enum Size {
XXS = 12,
XS = 24,
S = 38
XS = 18,
S = 24
}

interface StyledIconProps {
Expand Down
30 changes: 19 additions & 11 deletions src/lsg/patterns/input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { colors } from '../colors';
import { getSpace, Size } from '../space';
import * as React from 'react';
import styled from 'styled-components';

Expand All @@ -21,26 +22,33 @@ const StyledInput = styled.input`
/* reset Styles */
-webkit-appearance:textfield;
outline: none;
border: none;
background: transparent;
margin: 0 ${getSpace(Size.L)}px;
font-size: 15px;
box-sizing: border-box;
display: block;
width: 100%;
padding: 8px 11px;
border: 1px solid ${colors.grey90.toString()};
color: ${colors.grey60.toString()};
:focus {
box-shadow: 0 0 10px ${colors.blue40.toRGBString(0.5)};
padding: 8px 11px;
border: 1px solid ${colors.blue40.toString()};
}
width: calc(100% - ${getSpace(Size.M)*2}px);
color: ${colors.black.toString()};
font-weight: 500;
transition: color 0.2s;
::placeholder {
color: ${colors.grey90.toString()};
color: ${colors.grey50.toString()};
}
:hover {
::placeholder {
color: ${colors.black.toString()};
}
}
::-webkit-search-decoration {
display:none;
}
}
`;

const Input: React.StatelessComponent<InputProps> = props => (
Expand Down
6 changes: 4 additions & 2 deletions src/lsg/patterns/panes/patterns-pane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ const StyledPatternsPane = styled.div`
flex-grow: 2;
flex-shrink: 0;
flex-basis: 40%;
padding: ${getSpace(Size.L)}px 0;
border-top: 2px solid ${colors.grey60.toString()};
padding: ${getSpace(Size.M)}px 0;
border-top: 1px solid ${colors.grey80.toString()};
overflow: scroll;
margin-left: -${getSpace(Size.L)}px;
margin-right: -${getSpace(Size.L)}px;
`;

const PatternsPane: React.StatelessComponent<{}> = props => <StyledPatternsPane>{props.children}</StyledPatternsPane>;
Expand Down
46 changes: 39 additions & 7 deletions src/lsg/patterns/pattern-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,68 @@ const StyledPatternList = styled.ul`
display: block;
padding: 0;
margin: 0;
> div {
display: flex;
flex-wrap: wrap;
}
`;

const StyledPatternLabel = styled.div`
margin-bottom: ${getSpace(Size.S)}px;
margin-top: ${getSpace(Size.L)}px;
margin-left: ${getSpace(Size.L)}px;
color: ${colors.grey60.toString()};
text-transform: capitalize;
`;

const StyledPatternListItem = styled.li`
display: flex;
align-items: center;
display: block;
padding: ${getSpace(Size.S)}px;
border: 1px solid ${colors.grey90.toString()};
margin: 0 0 ${getSpace(Size.S)}px 0;
margin: 0 0 ${getSpace(Size.XS)}px 0;
border-radius: 3px;
background: ${colors.white.toString()};
font-family: ${fonts().NORMAL_FONT};
font-size: 12px;
color: ${colors.black.toString()};
width: calc(50% - ${getSpace(Size.XS)/2}px - ${getSpace(Size.L)}px);
box-sizing: border-box;
text-align: center;
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.15);
margin-left: ${getSpace(Size.L)}px;
transition: box-shadow 0.2s;
&:nth-of-type(2n) {
margin-left: ${getSpace(Size.XS)}px;
margin-right: ${getSpace(Size.L)}px;
}
&:hover {
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.3);
}
${(props: PatternListItemProps) =>
props.draggable ? 'cursor: move;' : props.onClick ? 'cursor: pointer;' : ''};
`;

const StyledSVG = styled.svg`
margin-right: ${getSpace(Size.L)}px;
fill: ${colors.grey60.toString()};
fill: ${colors.grey50.toString()};
`;

const StyledIcon = styled(Icon)`
margin-right: ${getSpace(Size.L)}px;
margin: 0 auto;
display: block;
margin-bottom: ${getSpace(Size.XS)}px;
`;

const StyledPatternListItemLabel = styled.div`
text-align: center;
width: 100%;
display: block;
text-transform: capitalize;
color: ${colors.grey36.toString()};
`;

export const PatternListItem: React.StatelessComponent<PatternListItemProps> = props => {
Expand All @@ -63,7 +95,7 @@ export const PatternListItem: React.StatelessComponent<PatternListItemProps> = p
color={colors.grey60}
/>
)}
{props.children}
<StyledPatternListItemLabel>{props.children}</StyledPatternListItemLabel>
</StyledPatternListItem>
);
};
Expand Down

0 comments on commit 19b411e

Please sign in to comment.