@olea-bps/components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppBar/index.js +83 -0
- package/AppBar/styles.js +27 -0
- package/BookDetail/index.js +268 -0
- package/BookDetail/styles.js +124 -0
- package/Component/342/200/216JobsFilter/index.js +188 -0
- package/Component/342/200/216JobsFilter/styles.js +12 -0
- package/ConnectivityWarning/index.js +65 -0
- package/ConnectivityWarning/styles.js +19 -0
- package/ContactDetail/index.js +232 -0
- package/ContactDetail/styles.js +32 -0
- package/CourseDetail/index.js +357 -0
- package/CourseDetail/styles.js +59 -0
- package/CourseDetailDialog/index.js +169 -0
- package/CourseDetailDialog/styles.js +116 -0
- package/CourseInfo/index.js +219 -0
- package/CourseInfo/styles.js +40 -0
- package/DevelopmentDialog/index.js +208 -0
- package/DevelopmentDialog/styles.js +10 -0
- package/EventCodeInput/index.js +146 -0
- package/EventCodeInput/styles.js +108 -0
- package/FlexMenuEntry/index.js +84 -0
- package/FlexMenuEntry/styles.js +27 -0
- package/MainMenuEntry/index.js +88 -0
- package/MainMenuEntry/styles.js +28 -0
- package/MealItem/index.js +87 -0
- package/MealItem/styles.js +73 -0
- package/MensaMenu/index.js +307 -0
- package/MensaMenu/styles.js +94 -0
- package/MensaSlider/index.js +184 -0
- package/MensaSlider/styles.js +53 -0
- package/Modal/index.js +106 -0
- package/Modal/styles.js +8 -0
- package/NewsDetail/index.js +377 -0
- package/NewsDetail/styles.js +77 -0
- package/NewsList/index.js +120 -0
- package/NewsList/styles.js +19 -0
- package/NewsListItem/index.js +89 -0
- package/NewsListItem/styles.js +32 -0
- package/OtherCourses/index.js +152 -0
- package/OtherCourses/styles.js +10 -0
- package/PtsDeparture/index.js +140 -0
- package/PtsDeparture/styles.js +7 -0
- package/PtsStation/index.js +183 -0
- package/PtsStation/styles.js +47 -0
- package/QuickLinks/index.js +127 -0
- package/QuickLinks/styles.js +45 -0
- package/RoomDetail/index.js +281 -0
- package/RoomDetail/styles.js +56 -0
- package/ScaledImage/index.js +92 -0
- package/SearchResults/index.js +362 -0
- package/SearchResults/styles.js +59 -0
- package/SettingSection/index.js +54 -0
- package/SettingSection/styles.js +15 -0
- package/SettingsDialog/index.js +52 -0
- package/SettingsDialog/styles.js +12 -0
- package/SettingsDialogRadio/index.js +66 -0
- package/SettingsDialogRadio/styles.js +7 -0
- package/SettingsDialogSelect/index.js +73 -0
- package/SettingsDialogSelect/styles.js +7 -0
- package/TimetableCodeInput/index.js +201 -0
- package/TimetableCodeInput/styles.js +28 -0
- package/TimetableDay/index.js +266 -0
- package/TimetableDay/styles.js +103 -0
- package/TimetableEvent/index.js +163 -0
- package/TimetableEvent/styles.js +108 -0
- package/TimetableList/index.js +116 -0
- package/TimetableList/styles.js +109 -0
- package/TimetableMonth/index.js +156 -0
- package/TimetableMonth/styles.js +29 -0
- package/TimetableWeek/index.js +245 -0
- package/TimetableWeek/styles.js +58 -0
- package/TopNews/index.js +282 -0
- package/TopNews/styles.js +125 -0
- package/TopNewsHtwk/index.js +279 -0
- package/TopNewsHtwk/styles.js +142 -0
- package/WebView/index.js +108 -0
- package/WebView/styles.js +11 -0
- package/index.js +39 -0
- package/package.json +37 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export default function(theme) {
|
|
2
|
+
return {
|
|
3
|
+
selectOption: {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
justifyContent: 'space-between'
|
|
7
|
+
},
|
|
8
|
+
listItemTitle: {
|
|
9
|
+
fontSize: theme.fontSizes.l
|
|
10
|
+
},
|
|
11
|
+
listItemDescription: {
|
|
12
|
+
fontSize: theme.fontSizes.m,
|
|
13
|
+
color: theme.colors.textLighter
|
|
14
|
+
},
|
|
15
|
+
buttonLabel: {
|
|
16
|
+
fontSize: theme.fontSizes.m,
|
|
17
|
+
color: theme.colors.text,
|
|
18
|
+
},
|
|
19
|
+
dialogTitle: {
|
|
20
|
+
fontSize: theme.fontSizes.l,
|
|
21
|
+
lineHeight: theme.lineHeights.xxl
|
|
22
|
+
},
|
|
23
|
+
dialogContent: {
|
|
24
|
+
fontSize: theme.fontSizes.m,
|
|
25
|
+
color: theme.colors.text,
|
|
26
|
+
},
|
|
27
|
+
listItems: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
container: {
|
|
32
|
+
flex: 1,
|
|
33
|
+
backgroundColor: theme.colors.contentBackground,
|
|
34
|
+
},
|
|
35
|
+
paragraph: {
|
|
36
|
+
paddingTop: theme.paddings.default,
|
|
37
|
+
paddingLeft: theme.paddings.default,
|
|
38
|
+
paddingRight: theme.paddings.default
|
|
39
|
+
},
|
|
40
|
+
paragraphText: {
|
|
41
|
+
fontSize: theme.fontSizes.l,
|
|
42
|
+
lineHeight: theme.lineHeights.l
|
|
43
|
+
},
|
|
44
|
+
linkText: {
|
|
45
|
+
fontSize: theme.fontSizes.l,
|
|
46
|
+
lineHeight: theme.lineHeights.l,
|
|
47
|
+
textDecorationLine: 'underline',
|
|
48
|
+
color: 'blue'
|
|
49
|
+
},
|
|
50
|
+
importButtonLabel: {
|
|
51
|
+
color: theme.colors.messages.noticeText,
|
|
52
|
+
...theme.fonts.medium,
|
|
53
|
+
fontSize: theme.fontSizes.xl,
|
|
54
|
+
lineHeight: theme.lineHeights.l,
|
|
55
|
+
marginLeft: theme.paddings.small
|
|
56
|
+
},
|
|
57
|
+
continueWithoutCodeButtonLabel:{
|
|
58
|
+
color: theme.colors.primary,
|
|
59
|
+
...theme.fonts.medium,
|
|
60
|
+
fontSize: theme.fontSizes.xl,
|
|
61
|
+
lineHeight: theme.lineHeights.l,
|
|
62
|
+
marginLeft: theme.paddings.small
|
|
63
|
+
},
|
|
64
|
+
importTextInput:{
|
|
65
|
+
paddingLeft: theme.paddings.default,
|
|
66
|
+
paddingRight: theme.paddings.default
|
|
67
|
+
},
|
|
68
|
+
orText:{
|
|
69
|
+
fontSize: theme.fontSizes.l,
|
|
70
|
+
lineHeight: theme.lineHeights.xxl,
|
|
71
|
+
textAlign: "center"
|
|
72
|
+
},
|
|
73
|
+
importButton:{
|
|
74
|
+
flexDirection: 'row',
|
|
75
|
+
flexWrap: 'wrap',
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
marginTop: 10,
|
|
79
|
+
marginLeft: 20,
|
|
80
|
+
marginRight: 20,
|
|
81
|
+
padding: theme.paddings.small,
|
|
82
|
+
flex: 1,
|
|
83
|
+
backgroundColor: theme.colors.primary,
|
|
84
|
+
borderBottomRightRadius: 10,
|
|
85
|
+
borderBottomLeftRadius: 10,
|
|
86
|
+
borderTopRightRadius: 10,
|
|
87
|
+
borderTopLeftRadius: 10
|
|
88
|
+
},
|
|
89
|
+
continueWithoutCodeButton:{
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
flexWrap: 'wrap',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
marginTop: 10,
|
|
95
|
+
marginLeft: 20,
|
|
96
|
+
marginRight: 20,
|
|
97
|
+
padding: theme.paddings.small,
|
|
98
|
+
flex: 1,
|
|
99
|
+
borderColor: theme.colors.primary,
|
|
100
|
+
borderWidth: 1,
|
|
101
|
+
borderBottomRightRadius: 10,
|
|
102
|
+
borderBottomLeftRadius: 10,
|
|
103
|
+
borderTopRightRadius: 10,
|
|
104
|
+
borderTopLeftRadius: 10
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
View,
|
|
17
|
+
Text,
|
|
18
|
+
TouchableOpacity,
|
|
19
|
+
Image,
|
|
20
|
+
GestureResponderEvent,
|
|
21
|
+
} from 'react-native';
|
|
22
|
+
|
|
23
|
+
import { useTheme } from 'react-native-paper';
|
|
24
|
+
|
|
25
|
+
import IconsOpenasist from '@olea-bps/icons-openasist';
|
|
26
|
+
|
|
27
|
+
import componentStyles from './styles';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Menüeintrag für das FlexMenü-Modul.
|
|
31
|
+
* Zeigt einen Entrag mit einem Titel, einer optionalen Beshreibung, ein optionales linksbündiges Icon und ein rechtsbündiges Icon.
|
|
32
|
+
*
|
|
33
|
+
* Wird kein rechtsbündiges Icon(rightIcon) festgelegt, wird automatisch das Icon für "forward" verwendet.
|
|
34
|
+
*
|
|
35
|
+
* @param {object} props
|
|
36
|
+
* @param {string} props.title Titel des Eintrages
|
|
37
|
+
* @param {string} [props.description] Beschreibung des Eintrages
|
|
38
|
+
* @param {string} [props.leftIconImage] URL oder URI der linksbündigen Icons
|
|
39
|
+
* @param {string} [props.rightIcon] Bezeichner des rechtsbündigen Icons
|
|
40
|
+
* @param {(event: GestureResponderEvent) => void} [props.onPress] Callback-Funktion die beim drücken des Eintrages ausgeführt wird. (Siehe: {@link https://reactnative.dev/docs/pressable#onpress})
|
|
41
|
+
*/
|
|
42
|
+
export default function FlexMenuEntry({ title, description, leftIconImage, rightIcon, onPress }) {
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const { themeStyles, colors } = theme;
|
|
45
|
+
|
|
46
|
+
const styles = componentStyles(theme);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<TouchableOpacity
|
|
50
|
+
role='button'
|
|
51
|
+
style={themeStyles.card}
|
|
52
|
+
onPress={onPress}
|
|
53
|
+
aria-label={
|
|
54
|
+
// Wen eine Beschreibung vorhanden ist, bilde aus Titel und Beschreibung einen Vorlesetext, ansonsten verwende nur den Titel
|
|
55
|
+
description
|
|
56
|
+
// Title und Beschreibung wird mit einer newline(\n) verbunden, damit eine Pause beim Vorlesen gelassen wird
|
|
57
|
+
? `${title} \n ${description}`
|
|
58
|
+
: title
|
|
59
|
+
}
|
|
60
|
+
>
|
|
61
|
+
{
|
|
62
|
+
leftIconImage
|
|
63
|
+
? <View style={styles.leftIconImage} >
|
|
64
|
+
<Image
|
|
65
|
+
style={{ resizeMode: 'contain', width: 30, height: 30 }}
|
|
66
|
+
source={{ uri: leftIconImage }}
|
|
67
|
+
/>
|
|
68
|
+
</View>
|
|
69
|
+
: null
|
|
70
|
+
}
|
|
71
|
+
<View style={[themeStyles.cardContent, styles.cardContent]}>
|
|
72
|
+
<Text style={styles.title}>{title}</Text>
|
|
73
|
+
{
|
|
74
|
+
description
|
|
75
|
+
? <Text style={styles.description}>{description}</Text>
|
|
76
|
+
: null
|
|
77
|
+
}
|
|
78
|
+
</View>
|
|
79
|
+
<View style={[themeStyles.cardRightIcon]}>
|
|
80
|
+
<IconsOpenasist icon={rightIcon ?? 'forward'} size={25} color={colors.icon} />
|
|
81
|
+
</View>
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default function (theme) {
|
|
2
|
+
return {
|
|
3
|
+
cardContent: {
|
|
4
|
+
justifyContent: 'center',
|
|
5
|
+
alignItems: 'flex-start'
|
|
6
|
+
},
|
|
7
|
+
title: {
|
|
8
|
+
flexWrap: 'wrap',
|
|
9
|
+
justifyContent: 'center',
|
|
10
|
+
fontSize: theme.fontSizes.l,
|
|
11
|
+
...theme.fonts.light,
|
|
12
|
+
},
|
|
13
|
+
leftIconImage: {
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
alignContent: 'center',
|
|
16
|
+
paddingRight: theme.paddings.default,
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
width: 250,
|
|
20
|
+
fontSize: theme.fontSizes.s,
|
|
21
|
+
...theme.fonts.regular,
|
|
22
|
+
lineHeight: theme.lineHeights.xxs,
|
|
23
|
+
color: theme.colors.subtitle,
|
|
24
|
+
marginTop: theme.paddings.xsmall
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import { View, TouchableOpacity, Text, StyleSheet, TouchableNativeFeedback } from 'react-native'
|
|
17
|
+
|
|
18
|
+
import { useTheme } from 'react-native-paper';
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import { useNavigation } from '@react-navigation/native';
|
|
21
|
+
|
|
22
|
+
import IconsOpenasist from '@olea-bps/icons-openasist';
|
|
23
|
+
|
|
24
|
+
import componentStyles from './styles';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Ein einzelner Eintrag im Hauptmenü, welcher beim draufdrücken eine View oder URL öffnet.
|
|
28
|
+
* Ein Eintrag wird mit einem Icon und einem Titel dargestellt.
|
|
29
|
+
*
|
|
30
|
+
* Soll eine View geöffnet werden, muss die `view`-Eigenschaft mit dem Namen der View gesetzt werden.
|
|
31
|
+
* Ist URL in einer Webview zu öffnen, ist die `url`-Eigenschaft mit der zu öffnenden URL oder einem Übersetzungsschlüssel zu setzen.
|
|
32
|
+
* Wird ein Übersetzungsschlüssel in die `url`-Eigenschaft hinterlegt, muss die `isLocalized`Eigenschaft auf true gesetzt werden.
|
|
33
|
+
* Die Webview wird mit dem Titel des Eintrags initialisert.
|
|
34
|
+
*
|
|
35
|
+
* Für die Eigenschaften icon, iconSVG und iconSize siehe {@link IconsOpenasist}.
|
|
36
|
+
*
|
|
37
|
+
* @param {object} props
|
|
38
|
+
* @param {string} props.title Titel des Menüeintrages. Dies kann der direkte Titel oder ein Übersetungsschlüssel sein
|
|
39
|
+
* @param {string} [props.view] Name der View, zu der gewechselt werden soll
|
|
40
|
+
* @param {string} [props.url] URL, welche in einer Webview geöffnet werde soll
|
|
41
|
+
* @param {boolean} [props.isLocalized] Soll der URL-String durch die Übersetzung gegeben werden, um die entgültige URL zu bekommen
|
|
42
|
+
* @param {string} [props.icon] Schlüssel des Icons (siehe {@link IconsOpenasist})
|
|
43
|
+
* @param {string} [props.iconSVG] siehe {@link IconsOpenasist}
|
|
44
|
+
* @param {number} [props.iconSize] Größe des Icons (siehe {@link IconsOpenasist})
|
|
45
|
+
*/
|
|
46
|
+
export default function MainMenuEntry({ title, icon, iconSVG, iconSize, view, url, isLocalized }) {
|
|
47
|
+
const { t } = useTranslation();
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
const { colors } = theme;
|
|
50
|
+
const navigation = useNavigation();
|
|
51
|
+
const styles = StyleSheet.create(componentStyles(theme));
|
|
52
|
+
|
|
53
|
+
const translatedTitle = t(title);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<TouchableOpacity
|
|
57
|
+
style={styles.entry}
|
|
58
|
+
background={TouchableNativeFeedback.Ripple(colors.background, false)}
|
|
59
|
+
onPress={
|
|
60
|
+
() => {
|
|
61
|
+
if (view) {
|
|
62
|
+
navigation.navigate(view);
|
|
63
|
+
} else if (url) {
|
|
64
|
+
navigation.navigate(
|
|
65
|
+
'Web',
|
|
66
|
+
{
|
|
67
|
+
title: translatedTitle,
|
|
68
|
+
|
|
69
|
+
// Is isLocalized is true url is localized via i18n files, use the given key to get the correct url
|
|
70
|
+
url: (isLocalized ?? false)
|
|
71
|
+
? t(url)
|
|
72
|
+
: url,
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}>
|
|
78
|
+
<View style={styles.textContainer} accessiblity={true} accessibilityLabel={translatedTitle}>
|
|
79
|
+
<View style={styles.iconContainer}>
|
|
80
|
+
<IconsOpenasist icon={icon} iconSVG={iconSVG} color={colors.iconDefault} size={iconSize ?? 34} />
|
|
81
|
+
</View>
|
|
82
|
+
<Text style={styles.titleText}>
|
|
83
|
+
{translatedTitle}
|
|
84
|
+
</Text>
|
|
85
|
+
</View>
|
|
86
|
+
</TouchableOpacity>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default function (theme) {
|
|
2
|
+
return {
|
|
3
|
+
textContainer: {
|
|
4
|
+
flex: 1,
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
paddingVertical: 20,
|
|
7
|
+
paddingHorizontal: 20,
|
|
8
|
+
alignContent: 'center'
|
|
9
|
+
},
|
|
10
|
+
iconContainer: {
|
|
11
|
+
flex: 0.2
|
|
12
|
+
},
|
|
13
|
+
entry: {
|
|
14
|
+
backgroundColor: theme.colors.background,
|
|
15
|
+
paddingHorizontal: 0,
|
|
16
|
+
paddingVertical: 5,
|
|
17
|
+
borderBottomWidth: 1,
|
|
18
|
+
borderBottomColor: theme.colors.accent
|
|
19
|
+
},
|
|
20
|
+
titleText: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
lineHeight: theme.fontSizes.subtitle * 1.4,
|
|
23
|
+
fontSize: theme.fontSizes.subtitle,
|
|
24
|
+
marginTop: 1,
|
|
25
|
+
alignSelf: 'center'
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { useMemo } from 'react';
|
|
16
|
+
import {PixelRatio, StyleSheet, Text, TouchableOpacity} from 'react-native';
|
|
17
|
+
import { connect } from 'react-redux'
|
|
18
|
+
import { useTheme } from 'react-native-paper';
|
|
19
|
+
import { useNavigation } from '@react-navigation/native';
|
|
20
|
+
|
|
21
|
+
import componentStyles from "./styles"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Meal Item Component
|
|
26
|
+
*
|
|
27
|
+
* Shows a single meal of a mensa. Used for the mensa slider component.
|
|
28
|
+
*
|
|
29
|
+
* Parameters:
|
|
30
|
+
* - none
|
|
31
|
+
*
|
|
32
|
+
* Navigation-Parameters:
|
|
33
|
+
* - none
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
export function MealItemComponent({ meal, canteenId, menuDate, settings }) {
|
|
37
|
+
const theme = useTheme();
|
|
38
|
+
const navigation = useNavigation();
|
|
39
|
+
|
|
40
|
+
const styles = useMemo(
|
|
41
|
+
() => StyleSheet.create(componentStyles(theme)),
|
|
42
|
+
[theme]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const isBigFont = settings?.settingsAccessibility?.increaseFontSize ?? PixelRatio.getFontScale() > 2.8;
|
|
46
|
+
|
|
47
|
+
// Remove all additional inforamtions like ingredients from title
|
|
48
|
+
const regex = /(\(\d((\W)?(\d)?)+\))/gm;
|
|
49
|
+
|
|
50
|
+
let title = meal.title.replace(regex, '');
|
|
51
|
+
let isShorted = false;
|
|
52
|
+
if(title.length > 63 && !isBigFont) {
|
|
53
|
+
isShorted = true;
|
|
54
|
+
title = title.slice(0, 60);
|
|
55
|
+
} else if (title.length > 38 && isBigFont) {
|
|
56
|
+
isShorted = true;
|
|
57
|
+
title = title.slice(0, 35);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<TouchableOpacity
|
|
62
|
+
style={[styles.mensaItem, isBigFont ? {width: 250} : '']}
|
|
63
|
+
onPress={
|
|
64
|
+
() => navigation.navigate(
|
|
65
|
+
'canteensTab',
|
|
66
|
+
{
|
|
67
|
+
screen: 'Canteens',
|
|
68
|
+
params: {
|
|
69
|
+
'canteenId': canteenId,
|
|
70
|
+
'menuDate': menuDate,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
>
|
|
76
|
+
<Text style={styles.mensaItemText}>{title} {isShorted ? '...' : ''}</Text>
|
|
77
|
+
</TouchableOpacity>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const mapStateToProps = state => {
|
|
82
|
+
return {
|
|
83
|
+
settings: state.settingReducer,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default connect(mapStateToProps)(MealItemComponent)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import color from "color";
|
|
2
|
+
|
|
3
|
+
export default function(theme) {
|
|
4
|
+
return {
|
|
5
|
+
mensaItem: {
|
|
6
|
+
width: 190,
|
|
7
|
+
height: '75%',
|
|
8
|
+
paddingHorizontal: theme.paddings.default,
|
|
9
|
+
borderRightWidth: 1,
|
|
10
|
+
borderRightColor: color(theme.colors.mensaSliderTextColor).alpha(0.5).rgb().string()
|
|
11
|
+
},
|
|
12
|
+
mensaItemText: {
|
|
13
|
+
fontSize: theme.fontSizes.itemText,
|
|
14
|
+
lineHeight: theme.lineHeights.s,
|
|
15
|
+
color: theme.colors.mensaSliderTextColor
|
|
16
|
+
},
|
|
17
|
+
modalContainer: {
|
|
18
|
+
flex: 1
|
|
19
|
+
},
|
|
20
|
+
modalContainerInner: {
|
|
21
|
+
flex: 1,
|
|
22
|
+
paddingTop: 20,
|
|
23
|
+
paddingHorizontal: 20
|
|
24
|
+
},
|
|
25
|
+
modalMenuTitle: {
|
|
26
|
+
fontSize: theme.fontSizes.xl,
|
|
27
|
+
lineHeight: theme.lineHeights.xl,
|
|
28
|
+
textAlign: 'left'
|
|
29
|
+
},
|
|
30
|
+
modalMenuDescription: {
|
|
31
|
+
fontSize: theme.fontSizes.l,
|
|
32
|
+
lineHeight: theme.lineHeights.l,
|
|
33
|
+
},
|
|
34
|
+
modalMenuImage: {
|
|
35
|
+
height: 240,
|
|
36
|
+
width: 'auto',
|
|
37
|
+
marginBottom: 40
|
|
38
|
+
},
|
|
39
|
+
modalMenuTable: {
|
|
40
|
+
flex: 1,
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
paddingVertical: 5
|
|
44
|
+
},
|
|
45
|
+
modalMenuTableCol: {
|
|
46
|
+
flex: 1,
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
paddingVertical: 20
|
|
49
|
+
},
|
|
50
|
+
modalMenuCol1: {
|
|
51
|
+
backgroundColor: theme.colors.primary,
|
|
52
|
+
},
|
|
53
|
+
modalMenuCol1Text: {
|
|
54
|
+
color: theme.colors.primaryText,
|
|
55
|
+
},
|
|
56
|
+
modalMenuCol2: {
|
|
57
|
+
backgroundColor: theme.colors.secondary,
|
|
58
|
+
},
|
|
59
|
+
modalMenuCol2Text: {
|
|
60
|
+
color: theme.colors.secondaryText,
|
|
61
|
+
},
|
|
62
|
+
modalMenuCol3: {
|
|
63
|
+
backgroundColor: theme.colors.tertiary,
|
|
64
|
+
},
|
|
65
|
+
modalMenuCol3Text: {
|
|
66
|
+
color: theme.colors.tertiaryText,
|
|
67
|
+
},
|
|
68
|
+
modalMenuPriceType: {
|
|
69
|
+
marginBottom: 10,
|
|
70
|
+
fontWeight: '700'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|