mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed commentform buttons
This commit is contained in:
parent
2673722af7
commit
fada25ee10
8 changed files with 97 additions and 23 deletions
|
@ -8,7 +8,7 @@ type IButtonProps = DetailedHTMLProps<
|
||||||
ButtonHTMLAttributes<HTMLButtonElement>,
|
ButtonHTMLAttributes<HTMLButtonElement>,
|
||||||
HTMLButtonElement
|
HTMLButtonElement
|
||||||
> & {
|
> & {
|
||||||
size?: 'mini' | 'normal' | 'big' | 'giant' | 'micro';
|
size?: 'mini' | 'normal' | 'big' | 'giant' | 'micro' | 'small';
|
||||||
iconLeft?: IIcon;
|
iconLeft?: IIcon;
|
||||||
iconRight?: IIcon;
|
iconRight?: IIcon;
|
||||||
seamless?: boolean;
|
seamless?: boolean;
|
||||||
|
@ -19,6 +19,7 @@ type IButtonProps = DetailedHTMLProps<
|
||||||
non_submitting?: boolean;
|
non_submitting?: boolean;
|
||||||
is_loading?: boolean;
|
is_loading?: boolean;
|
||||||
stretchy?: boolean;
|
stretchy?: boolean;
|
||||||
|
iconOnly?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Button: FC<IButtonProps> = ({
|
export const Button: FC<IButtonProps> = ({
|
||||||
|
@ -36,6 +37,7 @@ export const Button: FC<IButtonProps> = ({
|
||||||
title,
|
title,
|
||||||
stretchy,
|
stretchy,
|
||||||
disabled,
|
disabled,
|
||||||
|
iconOnly,
|
||||||
...props
|
...props
|
||||||
}) =>
|
}) =>
|
||||||
createElement(
|
createElement(
|
||||||
|
@ -49,7 +51,7 @@ export const Button: FC<IButtonProps> = ({
|
||||||
disabled,
|
disabled,
|
||||||
is_loading,
|
is_loading,
|
||||||
stretchy,
|
stretchy,
|
||||||
icon: (iconLeft || iconRight) && !title && !children,
|
icon: ((iconLeft || iconRight) && !title && !children) || iconOnly,
|
||||||
has_icon_left: !!iconLeft,
|
has_icon_left: !!iconLeft,
|
||||||
has_icon_right: !!iconRight,
|
has_icon_right: !!iconRight,
|
||||||
}),
|
}),
|
||||||
|
@ -57,7 +59,7 @@ export const Button: FC<IButtonProps> = ({
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
iconLeft && <Icon icon={iconLeft} size={20} key={0} />,
|
iconLeft && <Icon icon={iconLeft} size={20} key={0} />,
|
||||||
title ? <span key={1}>{title}</span> : (children && <span key={1}>{children}</span>) || null,
|
title ? <span>{title}</span> : children || null,
|
||||||
iconRight && <Icon icon={iconRight} size={20} key={2} />,
|
iconRight && <Icon icon={iconRight} size={20} key={2} />,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,10 +27,12 @@
|
||||||
stroke: white;
|
stroke: white;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
display: inline-flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
|
||||||
filter: grayscale(0);
|
filter: grayscale(0);
|
||||||
|
|
||||||
transition: opacity 0.25s, filter 0.25s, box-shadow 0.25s;
|
transition: opacity 0.25s, filter 0.25s, box-shadow 0.25s;
|
||||||
|
@ -38,6 +40,22 @@
|
||||||
|
|
||||||
@include outer_shadow();
|
@include outer_shadow();
|
||||||
|
|
||||||
|
input {
|
||||||
|
color: red;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
fill: white;
|
||||||
|
stroke: white;
|
||||||
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
@ -89,14 +107,22 @@
|
||||||
|
|
||||||
&:global(.disabled),
|
&:global(.disabled),
|
||||||
&:global(.grey) {
|
&:global(.grey) {
|
||||||
opacity: 0.3;
|
background: transparentize(white, 0.9);
|
||||||
background: lighten(black, 2%);
|
// background: lighten(white, 0.5);
|
||||||
// filter: grayscale(100%);
|
// filter: grayscale(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:global(.disabled) {
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
&:global(.icon) {
|
&:global(.icon) {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:global(.is_loading) {
|
&:global(.is_loading) {
|
||||||
|
@ -138,6 +164,15 @@
|
||||||
height: 28px;
|
height: 28px;
|
||||||
border-radius: $radius / 2;
|
border-radius: $radius / 2;
|
||||||
}
|
}
|
||||||
|
.small {
|
||||||
|
height: 32px;
|
||||||
|
// border-radius: $radius / 2;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.normal {
|
.normal {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
}
|
}
|
||||||
|
|
6
src/components/input/ButtonGroup/index.tsx
Normal file
6
src/components/input/ButtonGroup/index.tsx
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import React, { HTMLAttributes } from 'react';
|
||||||
|
import * as styles from './styles.scss';
|
||||||
|
|
||||||
|
type IProps = HTMLAttributes<HTMLDivElement> & {};
|
||||||
|
|
||||||
|
export const ButtonGroup = ({ children }: IProps) => <div className={styles.wrap}>{children}</div>;
|
21
src/components/input/ButtonGroup/styles.scss
Normal file
21
src/components/input/ButtonGroup/styles.scss
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
.wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: transparentize($color: #000000, $amount: 0.1) 1px 0;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-radius: 0 $input_radius $input_radius 0;
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-radius: $input_radius 0 0 $input_radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import { IState } from '~/redux/store';
|
||||||
import { getFileType } from '~/utils/uploader';
|
import { getFileType } from '~/utils/uploader';
|
||||||
import { selectUser } from '~/redux/auth/selectors';
|
import { selectUser } from '~/redux/auth/selectors';
|
||||||
import { getURL } from '~/utils/dom';
|
import { getURL } from '~/utils/dom';
|
||||||
|
import { ButtonGroup } from '~/components/input/ButtonGroup';
|
||||||
|
|
||||||
const mapStateToProps = (state: IState) => ({
|
const mapStateToProps = (state: IState) => ({
|
||||||
node: selectNode(state),
|
node: selectNode(state),
|
||||||
|
@ -133,14 +134,21 @@ const CommentFormUnconnected: FC<IProps> = ({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Group horizontal className={styles.buttons}>
|
<Group horizontal className={styles.buttons}>
|
||||||
|
<ButtonGroup>
|
||||||
|
<Button iconLeft="image" size="small" grey iconOnly>
|
||||||
<input type="file" onInput={onInputChange} multiple accept="image/*" />
|
<input type="file" onInput={onInputChange} multiple accept="image/*" />
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button iconRight="enter" size="small" grey iconOnly>
|
||||||
<input type="file" onInput={onInputChange} multiple accept="audio/*" />
|
<input type="file" onInput={onInputChange} multiple accept="audio/*" />
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
|
||||||
<Filler />
|
<Filler />
|
||||||
|
|
||||||
{is_sending_comment && <LoaderCircle size={20} />}
|
{is_sending_comment && <LoaderCircle size={20} />}
|
||||||
|
|
||||||
<Button size="mini" grey iconRight="enter" disabled={is_sending_comment}>
|
<Button size="small" grey iconRight="enter" disabled={is_sending_comment}>
|
||||||
Сказать
|
Сказать
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
|
@ -19,10 +19,4 @@
|
||||||
padding: $gap / 2;
|
padding: $gap / 2;
|
||||||
border-radius: 0 0 $radius $radius;
|
border-radius: 0 0 $radius $radius;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
svg {
|
|
||||||
fill: transparentize(white, 0.9);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @include outer_shadow();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,16 @@ const Sprites: FC<{}> = () => (
|
||||||
<path fill="none" d="M0 0h24v24H0V0z" />
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
||||||
<path d="M11 9l1.42 1.42L8.83 14H18V4h2v12H8.83l3.59 3.58L11 21l-6-6 6-6z" />
|
<path d="M11 9l1.42 1.42L8.83 14H18V4h2v12H8.83l3.59 3.58L11 21l-6-6 6-6z" />
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<g id="photo" stroke="none">
|
||||||
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
||||||
|
<path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="image" stroke="none">
|
||||||
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
||||||
|
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-5.04-6.71l-2.75 3.54-1.96-2.36L6.5 17h11l-3.54-4.71z" />
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@import "~raleway-cyrillic/raleway.css";
|
@import '~raleway-cyrillic/raleway.css';
|
||||||
|
|
||||||
html {
|
html {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
@ -7,24 +7,23 @@ html {
|
||||||
body {
|
body {
|
||||||
background: darken($main_bg_color, 12%);
|
background: darken($main_bg_color, 12%);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: url("http://vault48.org/pixmaps/texture.jpg");
|
background: url('http://vault48.org/pixmaps/texture.jpg');
|
||||||
color: $main_text_color;
|
color: $main_text_color;
|
||||||
font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
|
font: $font_16_regular;
|
||||||
sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
font-size: 16px;
|
// font-size: 16px;
|
||||||
fill: white;
|
fill: white;
|
||||||
stroke: white;
|
stroke: white;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "";
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
background: url("http://vault48.org/pixmaps/texture_alt.jpg");
|
background: url('http://vault48.org/pixmaps/texture_alt.jpg');
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,4 +79,3 @@ body {
|
||||||
:global(h2) {
|
:global(h2) {
|
||||||
font: $font_24_bold;
|
font: $font_24_bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue