1- import React , { Fragment } from "react"
1+ import React from "react"
22import styled from "styled-components"
33
44import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
55import { faPencilAlt as icon } from "@fortawesome/free-solid-svg-icons"
66import { OutboundLink } from "gatsby-plugin-google-analytics"
77import { get } from "lodash"
8+ import { Card , CardContent } from "@material-ui/core"
89
910import {
1011 fetchProgrammingExerciseDetails ,
1112 fetchProgrammingExerciseModelSolution ,
1213} from "../../services/moocfi"
13- import { Divider } from "@material-ui/core"
1414import LoginStateContext from "../../contexes/LoginStateContext"
1515import LoginControls from "../../components/LoginControls"
1616import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary"
1717import { normalizeExerciseId } from "../../util/strings"
18- import Loading from "../../components/Loading"
19- import Coins from "./Coins"
2018import ExerciseDescription from "./ExerciseDescription"
19+ import ExtraDetails from "./ExtraDetails"
20+ import StyledDivider from "../../components/StyledDivider"
2121
2222const accentColor = "#FAAA38"
2323
24- const ProgrammingExerciseWrapper = styled . section `
25- padding 1rem ;
26- margin-bottom: 2rem;
27- border-left: 0.2rem solid ${ accentColor } ;
28- 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) ;
29- border-radius: 4px ;
24+ const ProgrammingExerciseWrapper = styled ( Card ) `
25+ margin: 3.5rem 0 ;
26+ // border-left: 0. 2rem solid ${ accentColor } ;
27+ border-radius: 1rem !important ;
28+ box-shadow: 0 8px 40px -12px rgba(0,0,0,0.3) !important ;
29+ padding: 0 !important ;
3030`
3131
3232const StyledIcon = styled ( FontAwesomeIcon ) `
3333 vertical-align: middle;
34- margin-right: 1rem ;
34+ margin-right: 1.5rem ;
3535 margin-left: 0.5rem;
36- color: ${ accentColor } ;
36+ color: white;
37+ position: relative;
38+ bottom: -13px;
3739`
3840
39- const Header = styled . h3 `
41+ const Header = styled . div `
4042 font-size: 1.3rem;
4143 font-weight: normal;
42- padding-bottom: 1rem;
44+ padding 1rem 0 ;
4345 border-bottom: 1px solid #f7f7f9;
46+ background-color: #D23D48;
47+ display: flex;
48+ flex-direction: row;
49+ align-items: 0;
50+ color: white;
51+ padding: 1rem;
52+ padding-bottom: 1.5rem;
53+ h3 {
54+ margin-bottom: 0;
55+ }
56+ `
57+
58+ const HeaderTitleContainer = styled . div `
59+ flex: 1;
4460`
4561
4662const HeaderMuted = styled . span `
47- color: #818a91 !important;
48- font-size: 80%;
63+ font-size: 18px;
4964 font-weight: 400;
5065 margin-right: 0.2rem;
66+ position: relative;
67+ bottom: -3px;
5168`
5269
5370const Body = styled . div `
@@ -66,13 +83,8 @@ const LoginNagWrapper = styled.div`
6683 justify-content: center;
6784`
6885
69- const StyledDivider = styled ( Divider ) `
70- margin: 1rem 16px !important;
71- `
72-
7386const PointsWrapper = styled . span `
74- float: right;
75- color: #45484b;
87+ color: white;
7688`
7789
7890const Small = styled . div `
@@ -177,97 +189,66 @@ class ProgrammingExercise extends React.Component {
177189 id = { normalizeExerciseId ( `programming-exercise-${ name } ` ) }
178190 >
179191 < Header >
180- < StyledIcon icon = { icon } size = "1x" />
181- < HeaderMuted > Tehtävä: </ HeaderMuted >
182- { name }
192+ < StyledIcon icon = { icon } size = "2x" />
193+ < HeaderTitleContainer >
194+ < HeaderMuted > Ohjelmointitehtävä: </ HeaderMuted >
195+ < h3 > { name } </ h3 >
196+ </ HeaderTitleContainer >
183197 { points && points > 1 && (
184198 < PointsWrapper > { points } pisteen tehtävä</ PointsWrapper >
185199 ) }
186200 </ Header >
187- < Body >
188- < div >
189- { this . context . loggedIn ? (
190- < div >
191- { points && points > 1 && (
192- < Small >
193- < p >
194- Huom! Voit saada yksittäisen osan ratkaisusta osan
195- tehtävän pisteistä käyttämällä NetBeansin "submit"-nappia.
196- Lisätietoa ohjelmointitehtävien palautusohjeissa:{ " " }
197- < OutboundLink
198- href = "https://materiaalit.github.io/tmc-asennus/netbeans/"
199- rel = "noopener noreferrer"
200- target = "_blank"
201- >
202- ohjeet tehtävien palauttamiseen
203- </ OutboundLink >
204- .
205- </ p >
206- < StyledDivider />
207- </ Small >
208- ) }
209- < ExerciseDescription > { children } </ ExerciseDescription >
210- { this . state . exerciseDetails === null && (
211- < div > Error loading exercise details</ div >
212- ) }
213- </ div >
214- ) : (
215- < div >
216- < LoginNag > Kirjaudu sisään nähdäksesi tehtävanannon.</ LoginNag >
217- < LoginNagWrapper >
218- < LoginControls />
219- </ LoginNagWrapper >
220- </ div >
221- ) }
222- </ div >
201+ < CardContent >
202+ < Body >
203+ < div >
204+ { this . context . loggedIn ? (
205+ < div >
206+ { points && points > 1 && (
207+ < Small >
208+ < p >
209+ Huom! Voit saada yksittäisen osan ratkaisusta osan
210+ tehtävän pisteistä käyttämällä NetBeansin
211+ "submit"-nappia. Lisätietoa ohjelmointitehtävien
212+ palautusohjeissa:{ " " }
213+ < OutboundLink
214+ href = "https://materiaalit.github.io/tmc-asennus/netbeans/"
215+ rel = "noopener noreferrer"
216+ target = "_blank"
217+ >
218+ ohjeet tehtävien palauttamiseen
219+ </ OutboundLink >
220+ .
221+ </ p >
222+ < StyledDivider />
223+ </ Small >
224+ ) }
225+ < ExerciseDescription > { children } </ ExerciseDescription >
226+ { this . state . exerciseDetails === null && (
227+ < div > Error loading exercise details</ div >
228+ ) }
229+ </ div >
230+ ) : (
231+ < div >
232+ < LoginNag > Kirjaudu sisään nähdäksesi tehtävanannon.</ LoginNag >
233+ < LoginNagWrapper >
234+ < LoginControls />
235+ </ LoginNagWrapper >
236+ </ div >
237+ ) }
238+ </ div >
223239
224- { this . context . loggedIn && (
225- < Loading
226- loading = { this . state . exerciseDetails === undefined }
227- heightHint = "305px"
228- >
240+ { this . context . loggedIn && (
229241 < div >
230242 < StyledDivider />
231- < Coins
243+ < ExtraDetails
232244 exerciseDetails = { this . state . exerciseDetails }
233245 onUpdate = { this . onUpdate }
234- noCoins = { this . props . nocoins }
246+ noCoins = { this . props . noCoins }
235247 />
236-
237- { this . state . exerciseDetails && (
238- < Fragment >
239- < p >
240- Palauta tehtävä palvelimelle tarkistettavaksi NetBeans
241- ohjelmointiympäristössä:{ " " }
242- < OutboundLink
243- href = "https://materiaalit.github.io/tmc-asennus/netbeans/"
244- rel = "noopener noreferrer"
245- target = "_blank"
246- >
247- ohjeet tehtävien palauttamiseen
248- </ OutboundLink >
249- .
250- </ p >
251- < p >
252- Voit myöhemmin katsoa palautuksiasi Test My Code
253- palautusympäristössä{ " " }
254- < OutboundLink
255- href = { `https://tmc.mooc.fi/exercises/${
256- this . state . exerciseDetails . id
257- } ?use_clients=1`}
258- rel = "noopener noreferrer"
259- target = "_blank"
260- >
261- täältä
262- </ OutboundLink >
263- .
264- </ p >
265- </ Fragment >
266- ) }
267248 </ div >
268- </ Loading >
269- ) }
270- </ Body >
249+ ) }
250+ </ Body >
251+ </ CardContent >
271252 </ ProgrammingExerciseWrapper >
272253 )
273254 }
0 commit comments