Skip to content

Commit cba545c

Browse files
committed
Convert to NoticeView and add header to NoticeView
1 parent b2e1dcb commit cba545c

File tree

2 files changed

+47
-12
lines changed

2 files changed

+47
-12
lines changed

source/views/components/notice.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as React from 'react'
33
import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'
44
import * as c from './colors'
55
import {Button} from './button'
6+
import {Heading} from './markdown/heading'
67

78
const styles = StyleSheet.create({
89
container: {
@@ -23,18 +24,28 @@ const styles = StyleSheet.create({
2324
})
2425

2526
type Props = {
27+
header?: string,
2628
text?: string,
2729
style?: any,
2830
spinner?: boolean,
2931
buttonText?: string,
3032
onPress?: () => any,
3133
}
3234

33-
export function NoticeView({text, style, spinner, buttonText, onPress}: Props) {
35+
export function NoticeView({
36+
header,
37+
text,
38+
style,
39+
spinner,
40+
buttonText,
41+
onPress,
42+
}: Props) {
3443
return (
3544
<View style={[styles.container, style]}>
3645
{spinner ? <ActivityIndicator style={styles.spinner} /> : null}
3746

47+
<Heading level={1}>{header}</Heading>
48+
3849
<Text selectable={true} style={styles.text}>
3950
{text || 'Notice!'}
4051
</Text>

source/views/sis/tes.js

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
11
// @flow
22

33
import * as React from 'react'
4-
import {View, Component} from 'react-native'
4+
import {View, StyleSheet} from 'react-native'
55
import {TabBarIcon} from '../components/tabbar-icon'
66
import openUrl from '../components/open-url'
7+
import type {TopLevelViewPropsType} from '../types'
8+
import * as c from '../components/colors'
9+
import {NoticeView} from '../components/notice'
710

8-
class TESView extends React.Component {
9-
static navigationOptions = {
11+
type Props = TopLevelViewPropsType
12+
13+
export default class TESView extends React.PureComponent<Props> {
14+
static navigationOptions = {
1015
tabBarLabel: 'TES',
11-
tabBarIcon: TabBarIcon('card'),
16+
tabBarIcon: TabBarIcon('cash'),
1217
}
1318

14-
componentDidMount() {
15-
openUrl('https://www.stolaf.edu/apps/tes/')
16-
}
17-
18-
render() {
19-
return (<View></View>)
20-
}
19+
launchSite = () => {
20+
openUrl('https://www.stolaf.edu/apps/tes/')
21+
}
2122

23+
render() {
24+
return (
25+
<View style={styles.container}>
26+
<NoticeView
27+
buttonText="Open TES"
28+
header="Time Entry System"
29+
onPress={this.launchSite}
30+
text="The St. Olaf Time Entry System (TES) is the place to report your work hours, for both students and hourly staff."
31+
/>
32+
</View>
33+
)
34+
}
2235
}
36+
37+
const styles = StyleSheet.create({
38+
container: {
39+
alignItems: 'center',
40+
flexGrow: 1,
41+
flexDirection: 'column',
42+
justifyContent: 'center',
43+
backgroundColor: c.white,
44+
padding: 20,
45+
},
46+
})

0 commit comments

Comments
 (0)