質問編集履歴
3
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,11 +32,11 @@
|
|
32
32
|
|
33
33
|
height: '60%',
|
34
34
|
|
35
|
-
padding: '0 4px',
|
35
|
+
padding: '0 4px',
|
36
36
|
|
37
37
|
position: 'relative',
|
38
38
|
|
39
|
-
zIndex: '3',
|
39
|
+
zIndex: '3',
|
40
40
|
|
41
41
|
},
|
42
42
|
|
@@ -72,7 +72,7 @@
|
|
72
72
|
|
73
73
|
programTime: {
|
74
74
|
|
75
|
-
fontSize: '.7rem',
|
75
|
+
fontSize: '.7rem',
|
76
76
|
|
77
77
|
fontWeight: 'normal',
|
78
78
|
|
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
p1: {
|
86
86
|
|
87
|
-
flex: '0 0 ' + programWidth ( pt ),
|
87
|
+
flex: '0 0 ' + programWidth ( pt ),
|
88
88
|
|
89
89
|
},
|
90
90
|
|
@@ -96,12 +96,6 @@
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
//時間によるwidthを計算する必要あり。1hで11remというのを基準に、this.props.timeからこの番組の時間をはじき出し、
|
100
|
-
|
101
|
-
//それを関数に入れ、その関数をahroditeにぶちこむ
|
102
|
-
|
103
|
-
|
104
|
-
|
105
99
|
function programWidth (time) {
|
106
100
|
|
107
101
|
const min = 11/60;
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,11 +28,63 @@
|
|
28
28
|
|
29
29
|
const styles = StyleSheet.create({
|
30
30
|
|
31
|
+
tvProgramWrap: {
|
32
|
+
|
33
|
+
height: '60%',
|
34
|
+
|
35
|
+
padding: '0 4px', // tvProgramのbox-shadowの広がりの範囲と合わせることで、重なりをなくす
|
36
|
+
|
37
|
+
position: 'relative',
|
38
|
+
|
39
|
+
zIndex: '3', // 背景のsvgの上にくるようにする
|
40
|
+
|
41
|
+
},
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
tvProgram: {
|
46
|
+
|
47
|
+
height: '100%',
|
48
|
+
|
49
|
+
width: '100%',
|
50
|
+
|
51
|
+
background: 'white',
|
52
|
+
|
53
|
+
borderRadius: '100px',
|
54
|
+
|
55
|
+
boxShadow: '1px 1px 4px rgba(0,0,0,.25)',
|
56
|
+
|
57
|
+
display: 'flex',
|
58
|
+
|
59
|
+
alignItems: 'center',
|
60
|
+
|
61
|
+
justifyContent: 'center',
|
62
|
+
|
63
|
+
flexDirection: 'column',
|
64
|
+
|
65
|
+
fontWeight: 'bold',
|
66
|
+
|
67
|
+
fontSize: '.8rem',
|
68
|
+
|
69
|
+
},
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
programTime: {
|
74
|
+
|
75
|
+
fontSize: '.7rem', //programのfont-sizeと同様に、これも番組の時間に応じて調整できたらいいね
|
76
|
+
|
77
|
+
fontWeight: 'normal',
|
78
|
+
|
79
|
+
color: '#4b4b4b',
|
80
|
+
|
81
|
+
},
|
82
|
+
|
31
83
|
|
32
84
|
|
33
85
|
p1: {
|
34
86
|
|
35
|
-
flex: '0 0 ' + programWidth ( pt ),
|
87
|
+
flex: '0 0 ' + programWidth ( pt ), // timeで1時間 -> 11rem のため、30分は半分
|
36
88
|
|
37
89
|
},
|
38
90
|
|
@@ -40,7 +92,13 @@
|
|
40
92
|
|
41
93
|
|
42
94
|
|
43
|
-
const pt = this.props.runningTime;
|
95
|
+
const pt = this.props.runningTime;
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
//時間によるwidthを計算する必要あり。1hで11remというのを基準に、this.props.timeからこの番組の時間をはじき出し、
|
100
|
+
|
101
|
+
//それを関数に入れ、その関数をahroditeにぶちこむ
|
44
102
|
|
45
103
|
|
46
104
|
|
1
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,6 +15,10 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
```javascript
|
18
|
+
|
19
|
+
// TvProgram.jsx
|
20
|
+
|
21
|
+
|
18
22
|
|
19
23
|
import React from 'react';
|
20
24
|
|
@@ -90,6 +94,84 @@
|
|
90
94
|
|
91
95
|
```
|
92
96
|
|
97
|
+
```javascript
|
98
|
+
|
99
|
+
// TvPrograms.jsx
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
import React from 'react';
|
104
|
+
|
105
|
+
import { StyleSheet, css } from 'aphrodite';
|
106
|
+
|
107
|
+
import TvProgram from './TvProgram';
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
const styles = StyleSheet.create({
|
112
|
+
|
113
|
+
// 省略
|
114
|
+
|
115
|
+
});
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
const TvPrograms = () => (
|
120
|
+
|
121
|
+
<div className={css(styles.tvPrograms)}>
|
122
|
+
|
123
|
+
<TvProgram name="ニュース7" time="7:00 ~ 7:30" runningTime={30} />
|
124
|
+
|
125
|
+
<TvProgram name="うたコン" time="7:30 ~ 8:45" runningTime={75} />
|
126
|
+
|
127
|
+
<TvProgram name="ニュース7" time="8:45 ~ 9:00" runningTime={15} />
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
);
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
export default TvPrograms;
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
```
|
140
|
+
|
141
|
+
エラー文は以下の通り
|
142
|
+
|
143
|
+
```エラー文
|
144
|
+
|
145
|
+
TvProgram.jsx:37 Uncaught TypeError: Cannot read property 'runningTime' of undefined
|
146
|
+
|
147
|
+
at Object.defineProperty.value (TvProgram.jsx:37)
|
148
|
+
|
149
|
+
at __webpack_require__ (bootstrap fbd1499fd1e27da32198:19)
|
150
|
+
|
151
|
+
at Object.<anonymous> (TvPrograms.jsx:1)
|
152
|
+
|
153
|
+
at __webpack_require__ (bootstrap fbd1499fd1e27da32198:19)
|
154
|
+
|
155
|
+
at Object.defineProperty.value (TvListings.jsx:1)
|
156
|
+
|
157
|
+
at __webpack_require__ (bootstrap fbd1499fd1e27da32198:19)
|
158
|
+
|
159
|
+
at Object.defineProperty.value (PageOfTvListings.jsx:1)
|
160
|
+
|
161
|
+
at __webpack_require__ (bootstrap fbd1499fd1e27da32198:19)
|
162
|
+
|
163
|
+
at Object.<anonymous> (getPrefixedValue.js:13)
|
164
|
+
|
165
|
+
at __webpack_require__ (bootstrap fbd1499fd1e27da32198:19)
|
166
|
+
|
167
|
+
```
|
168
|
+
|
169
|
+
Tvprograms.jsxの中に`<TvProgram name="ニュース7" time="7:00 ~ 7:30" runningTime={30} />`のようなコンポネントが複数入っている感じです。
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
93
175
|
|
94
176
|
|
95
177
|
恐らくReactにおけるpropsの参照の仕方を深く理解していないことが原因だと思うのですが、Reactの公式ドキュメントを読んだり、いろいろ調べてみても解決方法がよくわからなかったため、こちらで質問させていただきます。
|