Skip to content

Commit 088d2fd

Browse files
author
Maksim Daunarovich
authored
UI Tweaks (#112)
* Change title * Add unique-names-generator package * Make error messages more readable with emphasis on important part. Prettify. * Add random name generator into popup. Add button to regenerate name. Adjust styles * Scroll window on hover and click, so highlighted line would be in the center of the editor * Add another case for suggestion tooltip
1 parent d4c4ef9 commit 088d2fd

File tree

8 files changed

+348
-208
lines changed

8 files changed

+348
-208
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"reset-css": "^5.0.1",
4141
"styled-components": "^5.2.0",
4242
"theme-ui": "^0.3.1",
43+
"unique-names-generator": "^4.3.1",
4344
"vscode-jsonrpc": "^5.0.1"
4445
},
4546
"devDependencies": {
Lines changed: 82 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,82 @@
1-
import styled from "styled-components"
2-
3-
interface InpubBlockProps {
4-
mb?: string
5-
}
6-
7-
export const InputBlock = styled.div<InpubBlockProps>`
8-
display: flex;
9-
flex-direction: column;
10-
margin-bottom: ${({mb = "0"}) => mb};
11-
`
12-
13-
export const Label = styled.p`
14-
margin: 0;
15-
font-size: 14px;
16-
margin-bottom: 5px;
17-
color: #000;
18-
`;
19-
20-
export const Type = styled.span`
21-
font-weight: normal;
22-
color: #3E98EB;
23-
margin-left: 4px;
24-
&:before{
25-
content: "(";
26-
}
27-
&:after{
28-
content: ")";
29-
}
30-
`
31-
32-
export const Input = styled.input`
33-
border: 1px solid #C4C4C4;
34-
font-size: 14px;
35-
color: #000;
36-
padding: 8px;
37-
width: 100%;
38-
font-weight: bold;
39-
margin-bottom: 5px;
40-
&:last-child{
41-
margin-bottom: 0;
42-
}
43-
`;
44-
45-
export const Error = styled.p`
46-
font-size: 12px;
47-
color: red;
48-
`;
1+
import React from 'react'
2+
import styled from "styled-components"
3+
4+
interface InpubBlockProps {
5+
mb?: string
6+
}
7+
8+
export const InputBlock = styled.div<InpubBlockProps>`
9+
display: flex;
10+
flex-direction: column;
11+
margin-bottom: ${({mb = "0"}) => mb};
12+
position: relative;
13+
`
14+
15+
export const Label = styled.p`
16+
margin: 0;
17+
font-size: 14px;
18+
margin-bottom: 5px;
19+
color: #000;
20+
`;
21+
22+
export const Type = styled.span`
23+
font-weight: normal;
24+
color: #3E98EB;
25+
margin-left: 4px;
26+
&:before{
27+
content: "(";
28+
}
29+
&:after{
30+
content: ")";
31+
}
32+
`
33+
34+
export const Input = styled.input`
35+
border: 1px solid #C4C4C4;
36+
font-size: 14px;
37+
color: #000;
38+
padding: 8px;
39+
width: 100%;
40+
font-weight: bold;
41+
margin-bottom: 5px;
42+
&:last-child{
43+
margin-bottom: 0;
44+
}
45+
`;
46+
47+
export const Error = styled.p`
48+
font-size: 12px;
49+
color: red;
50+
`;
51+
52+
export const InputIconContainer = styled.div`
53+
display: flex;
54+
align-items: center;
55+
justify-content: center;
56+
position: absolute;
57+
align-self: center;
58+
right: 0.75em;
59+
bottom: 0.9em;
60+
cursor: pointer;
61+
color: #888;
62+
user-select: none;
63+
64+
&:hover{
65+
color: #333;
66+
}
67+
`;
68+
69+
70+
type InputIconProps = {
71+
onClick?: any,
72+
icon: JSX.Element
73+
}
74+
75+
export const InputIcon = (props: InputIconProps) => {
76+
const { onClick, icon } = props
77+
return (
78+
<InputIconContainer onClick={onClick}>
79+
{icon}
80+
</InputIconContainer>
81+
)
82+
}

0 commit comments

Comments
 (0)