File tree 6 files changed +53
-4
lines changed
6 files changed +53
-4
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
UPDATE_NOTE ,
15
15
} from './actions' ;
16
16
import { getNotes } from './services/notes-service' ;
17
+ import DetailedNote from './pages/detailed-note/detailed-note' ;
17
18
18
19
function App ( ) {
19
20
const [ theme , setTheme ] = useState ( 'light' ) ;
@@ -95,6 +96,7 @@ function App() {
95
96
onHandleColor = "#000"
96
97
> </ Switch >
97
98
< Home > </ Home >
99
+ < DetailedNote > </ DetailedNote >
98
100
</ ThemeContext . Provider >
99
101
</ StateContext . Provider >
100
102
) ;
Original file line number Diff line number Diff line change 2
2
border : 1px solid grey;
3
3
padding : 2rem ;
4
4
font-size : 1rem ;
5
- height : 5rem ;
6
5
border-radius : 0.5rem ;
7
6
margin-top : 1rem ;
8
7
position : relative;
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ type NoteProps = {
16
16
createdAt : Date ;
17
17
updatedAt : Date ;
18
18
note : NoteType ;
19
+ isDetailed ?: boolean ;
20
+ height ?:string ;
19
21
} ;
20
22
21
23
function Note ( props : NoteProps ) {
@@ -31,19 +33,20 @@ function Note(props: NoteProps) {
31
33
console . log ( await deleteNote ( props . id ) ) ;
32
34
dispatch ( { type : DELETE_NOTE , payload : props . id } ) ;
33
35
} ;
34
-
36
+
37
+ const optionalProps = props . height ? { height :props . height } :{ }
35
38
return (
36
39
< Card
37
40
bgColor = {
38
41
theme === 'dark'
39
42
? props . priority && ColorDark [ props . priority ]
40
43
: props . priority && ColorLight [ props . priority ]
41
44
}
42
- height = "3"
43
45
padding = "1"
46
+ { ...optionalProps }
44
47
>
45
48
< >
46
- < div className = ' text'> { props . text } </ div >
49
+ < div className = { props . isDetailed ? '' : ' text'} > { props . text } </ div >
47
50
< div className = 'left-corner date' > { props . updatedAt . toLocaleString ( ) } </ div >
48
51
< div className = "right-corner" >
49
52
< FaEdit onClick = { ( ) => editNote ( props . note ) } > </ FaEdit >
Original file line number Diff line number Diff line change
1
+ .detailed-note {
2
+ margin : 0 ;
3
+ text-align : center;
4
+ padding-top : 1rem ;
5
+ }
6
+
7
+ .detailed-note .light {
8
+ background-color : white;
9
+ color : black;
10
+ }
11
+
12
+ .detailed-note .dark {
13
+ background-color : # 333 ;
14
+ color : white;
15
+ }
Original file line number Diff line number Diff line change
1
+ import './detailed-note.css' ;
2
+ import Note from '../../components/note/note' ;
3
+ import { useContext } from 'react' ;
4
+ import { ThemeContext } from '../../context/theme/theme' ;
5
+ import { StateContext } from '../../context/state/state' ;
6
+
7
+ function DetailedNote ( ) {
8
+ const theme = useContext ( ThemeContext ) ;
9
+ const { state } = useContext ( StateContext ) ;
10
+ const note = state . notes [ 0 ] ;
11
+ return (
12
+ < div className = { `detailed-note ${ theme } ` } >
13
+ < div >
14
+ { note && < Note
15
+ key = { note . id }
16
+ id = { note . id }
17
+ priority = { note . priority }
18
+ text = { note . text }
19
+ createdAt = { note . createdAt }
20
+ updatedAt = { note . updatedAt }
21
+ note = { note }
22
+ isDetailed = { true }
23
+ > </ Note > }
24
+ </ div >
25
+ </ div >
26
+ ) ;
27
+ }
28
+
29
+ export default DetailedNote ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ function Home() {
23
23
createdAt = { note . createdAt }
24
24
updatedAt = { note . updatedAt }
25
25
note = { note }
26
+ height = "3"
26
27
> </ Note >
27
28
) ) }
28
29
</ div >
You can’t perform that action at this time.
0 commit comments