1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-06-22 01:28:29 +07:00

comments mock

This commit is contained in:
muerwre 2019-07-26 18:26:35 +07:00
parent bdf7ba1ccb
commit 2a6604afaf
18 changed files with 340 additions and 12 deletions

View file

@ -0,0 +1,16 @@
import React, { FC } from 'react';
import classNames = require("classnames");
import * as styles from './styles.scss';
type IProps = React.HTMLAttributes<HTMLDivElement> & {}
const Card: FC<IProps> = ({
className,
children,
}) => (
<div className={classNames(styles.card, className)}>
{children}
</div>
);
export { Card };

View file

@ -0,0 +1,6 @@
.card {
background-color: #111111;
border-radius: $panel_radius;
@include outer_shadow();
}

View file

@ -0,0 +1,53 @@
import React, { FC } from 'react';
import classNames from 'classnames';
import * as styles from './styles.scss';
type IProps = React.HTMLAttributes<HTMLDivElement> & {
horizontal?: boolean;
vertical?: boolean;
columns?: string;
rows?: string;
size?: string;
square?: boolean;
gap?: number;
};
const Grid: FC<IProps> = ({
children,
className = '',
horizontal = false,
vertical = false,
square = false,
size = 'auto',
style = {},
columns = 'auto',
rows = 'auto',
gap = 20,
...props
}) => (
<div
className={classNames(
styles.grid,
className,
{
[styles.horizontal]: horizontal,
[styles.vertical]: !horizontal,
[styles.square]: square,
},
)}
style={{
...style,
gridTemplateColumns: square ? `repeat(auto-fill, ${(columns !== 'auto' && columns) || size})` : columns,
gridTemplateRows: square ? `repeat(auto-fill, ${(rows !== 'auto' && rows) || size})` : rows,
gridAutoRows: rows,
gridAutoColumns: columns,
gridRowGap: gap,
gridColumnGap: gap,
}}
{...props}
>
{children}
</div>
);
export { Grid };

View file

@ -0,0 +1,18 @@
.grid {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr;
grid-row-gap: $gap;
grid-column-gap: $gap;
grid-auto-flow: row;
grid-auto-rows: auto;
grid-auto-columns: auto;
&.horizontal {
grid-auto-flow: column;
}
&.square {
grid-auto-flow: dense;
}
}

View file

@ -0,0 +1,39 @@
import React, { FC } from 'react';
import classNames from 'classnames';
import * as styles from './styles.scss';
type IProps = React.HTMLAttributes<HTMLDivElement> & {
horizontal?: boolean;
top?: boolean;
bottom?: boolean;
wrap?: boolean;
};
const Group: FC<IProps> = ({
children,
className = '',
horizontal = false,
top = false,
bottom = false,
wrap = false,
...props
}) => (
<div
className={classNames(
styles.group,
{
[styles.horizontal]: horizontal,
[styles.vertical]: !horizontal,
[styles.top]: top,
[styles.bottom]: bottom,
[styles.wrap]: wrap,
},
className,
)}
{...props}
>
{children}
</div>
);
export { Group };

View file

@ -0,0 +1,42 @@
.group {
display: flex;
> :global(.group_filler) {
flex: 1;
}
&.vertical {
flex-direction: column;
& > * {
margin: $gap/2 0;
&:first-child { margin-top: 0; }
&:last-child { margin-bottom: 0; }
}
}
&.horizontal {
flex-direction: row;
align-items: center;
&.top {
align-items: flex-start;
}
&.bottom {
align-items: flex-end;
}
& > * {
margin: 0 $gap;
&:first-child { margin-left: 0; }
&:last-child { margin-right: 0; }
}
}
&.wrap {
flex-wrap: wrap;
}
}

View file

@ -0,0 +1,29 @@
import React, { FC } from 'react';
import * as styles from './styles.scss';
import classNames = require("classnames");
type IProps = React.HTMLAttributes<HTMLDivElement> & {
padding?: number;
vertical?: boolean;
horizontal?: boolean;
}
const Padder: FC<IProps> = ({
padding,
children,
className,
style = {},
vertical,
horizontal,
...props
}) => (
<div
className={classNames(styles.padder, className, { vertical, horizontal })}
style={padding ? { ...style, padding } : style}
{...props}
>
{children}
</div>
);
export { Padder };

View file

@ -0,0 +1,13 @@
.padder {
padding: $gap;
&:global(.horizontal) {
padding-top: 0;
padding-bottom: 0;
}
&:global(.vertical) {
padding-left: 0;
padding-right: 0;
}
}