Commit 09313f5f by tungnq

TODO: Chuyển các hàm logic ở file view sang function

parent 10a23b76
...@@ -601,3 +601,14 @@ export const getMimeType = fileExt => { ...@@ -601,3 +601,14 @@ export const getMimeType = fileExt => {
return '*/*'; return '*/*';
} }
}; };
export const monthNames = [
'Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12',
];
export const weekDays = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'];
export const formatDateToString = (date) => {
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
};
\ No newline at end of file
...@@ -22,8 +22,8 @@ const styles = StyleSheet.create({ ...@@ -22,8 +22,8 @@ const styles = StyleSheet.create({
paddingVertical: 15, paddingVertical: 15,
}, },
header_title: { header_title: {
fontSize: R.fontsize.fontsSizeTitle, fontSize: R.fontsize.fontsSize16,
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.InterMedium,
color: R.colors.black, color: R.colors.black,
fontWeight: '600', fontWeight: '600',
}, },
...@@ -32,14 +32,13 @@ const styles = StyleSheet.create({ ...@@ -32,14 +32,13 @@ const styles = StyleSheet.create({
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 20, borderRadius: 20,
backgroundColor: R.colors.blue, backgroundColor: R.colors.blue500,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center',
}, },
navButtonText: { navButtonText: {
color: R.colors.white, color: R.colors.white,
fontSize: R.fontsize.fontsSizeTitle, fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.InterMedium,
height: '100%', height: '100%',
}, },
...@@ -71,20 +70,20 @@ const styles = StyleSheet.create({ ...@@ -71,20 +70,20 @@ const styles = StyleSheet.create({
width: CELL_WIDTH, width: CELL_WIDTH,
minHeight: CELL_HEIGHT, minHeight: CELL_HEIGHT,
borderWidth: 1, borderWidth: 1,
borderColor: R.colors.grayBorderInputTextHeader, borderColor: R.colors.gray220,
padding: 6, padding: 6,
alignItems: 'center', alignItems: 'center',
}, },
// Ô ngày được chọn // Ô ngày được chọn
selectedDayCell: { selectedDayCell: {
borderColor: R.colors.blue, borderColor: R.colors.blue500,
borderWidth: 1, borderWidth: 1,
}, },
// Text số ngày // Text số ngày
dayText: { dayText: {
fontSize: R.fontsize.fontSizeLabel, fontSize: R.fontsize.fontsSize12,
fontWeight: '400', fontWeight: '400',
fontFamily: R.fonts.fontRegular, fontFamily: R.fonts.InterRegular,
color: R.colors.black, color: R.colors.black,
marginBottom: 2, marginBottom: 2,
}, },
...@@ -97,14 +96,14 @@ const styles = StyleSheet.create({ ...@@ -97,14 +96,14 @@ const styles = StyleSheet.create({
selectedDayText: { selectedDayText: {
color: R.colors.black, color: R.colors.black,
fontWeight: '500', fontWeight: '500',
fontFamily: R.fonts.fontSemiBold, fontFamily: R.fonts.InterSemiBold,
}, },
// Text ngày hôm nay // Text ngày hôm nay
todayText: { todayText: {
color: R.colors.white, color: R.colors.white,
fontWeight: 'bold', fontWeight: '500',
fontFamily: R.fonts.fontSemiBold, fontFamily: R.fonts.InterSemiBold,
backgroundColor: R.colors.blue, backgroundColor: R.colors.blue500,
borderRadius: 15, borderRadius: 15,
paddingHorizontal: 6, paddingHorizontal: 6,
paddingVertical: 4, paddingVertical: 4,
...@@ -121,27 +120,27 @@ const styles = StyleSheet.create({ ...@@ -121,27 +120,27 @@ const styles = StyleSheet.create({
paddingHorizontal: 5, paddingHorizontal: 5,
borderRadius: 10, borderRadius: 10,
marginBottom: 2, marginBottom: 2,
backgroundColor: R.colors.blue, backgroundColor: R.colors.blue500,
}, },
eventBarText: { eventBarText: {
fontSize: R.fontsize.fontSizeLabel, fontSize: R.fontsize.fontsSize12,
color: R.colors.white, color: R.colors.white,
fontWeight: '400', fontWeight: '400',
fontFamily: R.fonts.fontRegular, fontFamily: R.fonts.InterRegular,
}, },
// Text hiển thị số sự kiện còn lại // Text hiển thị số sự kiện còn lại
moreEventsText: { moreEventsText: {
fontSize: R.fontsize.fontSizeLabel, fontSize: R.fontsize.fontsSize12,
color: R.colors.gray, color: R.colors.gray200,
fontWeight: '400', fontWeight: '400',
fontFamily: R.fonts.fontRegular, fontFamily: R.fonts.InterRegular,
textAlign: 'center', textAlign: 'center',
}, },
// Modal bottom sheet // Modal bottom sheet
modalBackdrop: { modalBackdrop: {
flex: 1, flex: 1,
backgroundColor: R.colors.grayBorderInputTextHeader, backgroundColor: R.colors.gray220,
justifyContent: 'flex-end', justifyContent: 'flex-end',
}, },
bottomSheet: { bottomSheet: {
...@@ -159,7 +158,7 @@ const styles = StyleSheet.create({ ...@@ -159,7 +158,7 @@ const styles = StyleSheet.create({
dragHandle: { dragHandle: {
width: 40, width: 40,
height: 4, height: 4,
backgroundColor: R.colors.gray, backgroundColor: R.colors.gray150,
borderRadius: 5, borderRadius: 5,
alignSelf: 'center', alignSelf: 'center',
marginTop: 10, marginTop: 10,
...@@ -173,8 +172,8 @@ const styles = StyleSheet.create({ ...@@ -173,8 +172,8 @@ const styles = StyleSheet.create({
paddingHorizontal: 15, paddingHorizontal: 15,
}, },
bottomSheetTitle: { bottomSheetTitle: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.InterMedium,
color: R.colors.black, color: R.colors.black,
fontWeight: '600', fontWeight: '600',
flex: 1, flex: 1,
...@@ -184,14 +183,14 @@ const styles = StyleSheet.create({ ...@@ -184,14 +183,14 @@ const styles = StyleSheet.create({
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
backgroundColor: R.colors.gray, backgroundColor: R.colors.gray200,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
}, },
closeButtonText: { closeButtonText: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontsSize12,
color: R.colors.black, color: R.colors.black,
fontFamily: R.fonts.fontRegular, fontFamily: R.fonts.InterRegular,
fontWeight: '400', fontWeight: '400',
}, },
...@@ -213,9 +212,9 @@ const styles = StyleSheet.create({ ...@@ -213,9 +212,9 @@ const styles = StyleSheet.create({
paddingVertical: 40, paddingVertical: 40,
}, },
noEventsText: { noEventsText: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.fontRegular, fontFamily: R.fonts.InterRegular,
color: R.colors.gray, color: R.colors.gray200,
fontWeight: '400', fontWeight: '400',
}, },
...@@ -228,8 +227,8 @@ const styles = StyleSheet.create({ ...@@ -228,8 +227,8 @@ const styles = StyleSheet.create({
marginBottom: 10, marginBottom: 10,
marginHorizontal: 15, marginHorizontal: 15,
borderLeftWidth: 4, borderLeftWidth: 4,
borderLeftColor: R.colors.blue, borderLeftColor: R.colors.blue500,
shadowColor: R.colors.black, shadowColor: R.colors.black250,
shadowOffset: { shadowOffset: {
width: 0, width: 0,
height: 2, height: 2,
...@@ -246,9 +245,9 @@ const styles = StyleSheet.create({ ...@@ -246,9 +245,9 @@ const styles = StyleSheet.create({
marginRight: 15, marginRight: 15,
}, },
eventTime: { eventTime: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.InterMedium,
color: R.colors.blue, color: R.colors.blue500,
fontWeight: '600', fontWeight: '600',
}, },
// Container nội dung sự kiện // Container nội dung sự kiện
...@@ -256,16 +255,16 @@ const styles = StyleSheet.create({ ...@@ -256,16 +255,16 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
}, },
eventTitle: { eventTitle: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.InterRegular,
color: R.colors.black, color: R.colors.black,
fontWeight: '600', fontWeight: '600',
marginBottom: 4, marginBottom: 4,
}, },
eventDescription: { eventDescription: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.fontRegular, fontFamily: R.fonts.InterRegular,
color: R.colors.gray2, color: R.colors.gray200,
fontWeight: '400', fontWeight: '400',
}, },
}); });
......
...@@ -13,6 +13,7 @@ import R from '../../assets/R'; ...@@ -13,6 +13,7 @@ import R from '../../assets/R';
import { styles, CELL_WIDTH, BOTTOM_SHEET_HEIGHT } from './style'; import { styles, CELL_WIDTH, BOTTOM_SHEET_HEIGHT } from './style';
import { useNavigation } from '@react-navigation/native'; import { useNavigation } from '@react-navigation/native';
import * as SCREENNAME from '../../routers/ScreenNames'; import * as SCREENNAME from '../../routers/ScreenNames';
import { monthNames , weekDays, formatDateToString} from '../../config/Functions';
LogBox.ignoreAllLogs( LogBox.ignoreAllLogs(
true true
); );
...@@ -36,11 +37,6 @@ const ClassScheduleView = ({ ...@@ -36,11 +37,6 @@ const ClassScheduleView = ({
}) => { }) => {
const navigation = useNavigation(); const navigation = useNavigation();
const renderHeader = () => { const renderHeader = () => {
const monthNames = [
'Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12',
];
return ( return (
<View style={styles.header}> <View style={styles.header}>
<TouchableOpacity <TouchableOpacity
...@@ -63,8 +59,6 @@ const ClassScheduleView = ({ ...@@ -63,8 +59,6 @@ const ClassScheduleView = ({
}; };
const renderWeekDays = () => { const renderWeekDays = () => {
const weekDays = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'];
return ( return (
<View style={styles.weekDaysContainer}> <View style={styles.weekDaysContainer}>
{weekDays.map((day, index) => ( {weekDays.map((day, index) => (
...@@ -127,12 +121,7 @@ const ClassScheduleView = ({ ...@@ -127,12 +121,7 @@ const ClassScheduleView = ({
); );
}; };
const formatDateToString = (date) => {
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
};
const renderCalendarGrid = () => { const renderCalendarGrid = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment