forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextBox.js
More file actions
56 lines (47 loc) · 1.34 KB
/
TextBox.js
File metadata and controls
56 lines (47 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from "react"
import styled from "styled-components"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faInfoCircle, faUserGraduate } from "@fortawesome/free-solid-svg-icons"
import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary"
const Wrapper = styled.aside`
padding 1rem;
margin-bottom: 2rem;
border-left: 0.2rem solid var(--color);
box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 2px 1px -1px rgba(0, 0, 0, 0.12);
border-radius: 4px;
`
const StyledIcon = styled(FontAwesomeIcon)`
vertical-align: middle;
margin-right: 1rem;
margin-left: 0.5rem;
color: var(--color);
`
const Header = styled.h3`
font-size: 1.3rem;
font-weight: normal;
padding-bottom: 1rem;
border-bottom: 1px solid #f7f7f9;
`
const Body = styled.div`
padding-bottom: 0.5rem;
`
const variantToColor = {
hint: "#528afc",
learningObjectives: "#57b181",
}
const variantToIcon = {
hint: faInfoCircle,
learningObjectives: faUserGraduate,
}
const TextBox = props => {
return (
<Wrapper style={{ "--color": variantToColor[props.variant] }}>
<Header>
<StyledIcon icon={variantToIcon[props.variant]} size="1x" />
{props.name}
</Header>
<Body>{props.children}</Body>
</Wrapper>
)
}
export default withSimpleErrorBoundary(TextBox)