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 => {
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({
paddingVertical: 15,
},
header_title: {
fontSize: R.fontsize.fontsSizeTitle,
fontFamily: R.fonts.fontMedium,
fontSize: R.fontsize.fontsSize16,
fontFamily: R.fonts.InterMedium,
color: R.colors.black,
fontWeight: '600',
},
......@@ -32,14 +32,13 @@ const styles = StyleSheet.create({
width: 30,
height: 30,
borderRadius: 20,
backgroundColor: R.colors.blue,
backgroundColor: R.colors.blue500,
alignItems: 'center',
justifyContent: 'center',
},
navButtonText: {
color: R.colors.white,
fontSize: R.fontsize.fontsSizeTitle,
fontFamily: R.fonts.fontMedium,
fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.InterMedium,
height: '100%',
},
......@@ -71,20 +70,20 @@ const styles = StyleSheet.create({
width: CELL_WIDTH,
minHeight: CELL_HEIGHT,
borderWidth: 1,
borderColor: R.colors.grayBorderInputTextHeader,
borderColor: R.colors.gray220,
padding: 6,
alignItems: 'center',
},
// Ô ngày được chọn
selectedDayCell: {
borderColor: R.colors.blue,
borderColor: R.colors.blue500,
borderWidth: 1,
},
// Text số ngày
dayText: {
fontSize: R.fontsize.fontSizeLabel,
fontSize: R.fontsize.fontsSize12,
fontWeight: '400',
fontFamily: R.fonts.fontRegular,
fontFamily: R.fonts.InterRegular,
color: R.colors.black,
marginBottom: 2,
},
......@@ -97,14 +96,14 @@ const styles = StyleSheet.create({
selectedDayText: {
color: R.colors.black,
fontWeight: '500',
fontFamily: R.fonts.fontSemiBold,
fontFamily: R.fonts.InterSemiBold,
},
// Text ngày hôm nay
todayText: {
color: R.colors.white,
fontWeight: 'bold',
fontFamily: R.fonts.fontSemiBold,
backgroundColor: R.colors.blue,
fontWeight: '500',
fontFamily: R.fonts.InterSemiBold,
backgroundColor: R.colors.blue500,
borderRadius: 15,
paddingHorizontal: 6,
paddingVertical: 4,
......@@ -121,27 +120,27 @@ const styles = StyleSheet.create({
paddingHorizontal: 5,
borderRadius: 10,
marginBottom: 2,
backgroundColor: R.colors.blue,
backgroundColor: R.colors.blue500,
},
eventBarText: {
fontSize: R.fontsize.fontSizeLabel,
fontSize: R.fontsize.fontsSize12,
color: R.colors.white,
fontWeight: '400',
fontFamily: R.fonts.fontRegular,
fontFamily: R.fonts.InterRegular,
},
// Text hiển thị số sự kiện còn lại
moreEventsText: {
fontSize: R.fontsize.fontSizeLabel,
color: R.colors.gray,
fontSize: R.fontsize.fontsSize12,
color: R.colors.gray200,
fontWeight: '400',
fontFamily: R.fonts.fontRegular,
fontFamily: R.fonts.InterRegular,
textAlign: 'center',
},
// Modal bottom sheet
modalBackdrop: {
flex: 1,
backgroundColor: R.colors.grayBorderInputTextHeader,
backgroundColor: R.colors.gray220,
justifyContent: 'flex-end',
},
bottomSheet: {
......@@ -159,7 +158,7 @@ const styles = StyleSheet.create({
dragHandle: {
width: 40,
height: 4,
backgroundColor: R.colors.gray,
backgroundColor: R.colors.gray150,
borderRadius: 5,
alignSelf: 'center',
marginTop: 10,
......@@ -173,8 +172,8 @@ const styles = StyleSheet.create({
paddingHorizontal: 15,
},
bottomSheetTitle: {
fontSize: R.fontsize.fontSizeContent,
fontFamily: R.fonts.fontMedium,
fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.InterMedium,
color: R.colors.black,
fontWeight: '600',
flex: 1,
......@@ -184,14 +183,14 @@ const styles = StyleSheet.create({
width: 30,
height: 30,
borderRadius: 15,
backgroundColor: R.colors.gray,
backgroundColor: R.colors.gray200,
alignItems: 'center',
justifyContent: 'center',
},
closeButtonText: {
fontSize: R.fontsize.fontSizeContent,
fontSize: R.fontsize.fontsSize12,
color: R.colors.black,
fontFamily: R.fonts.fontRegular,
fontFamily: R.fonts.InterRegular,
fontWeight: '400',
},
......@@ -213,9 +212,9 @@ const styles = StyleSheet.create({
paddingVertical: 40,
},
noEventsText: {
fontSize: R.fontsize.fontSizeContent,
fontFamily: R.fonts.fontRegular,
color: R.colors.gray,
fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.InterRegular,
color: R.colors.gray200,
fontWeight: '400',
},
......@@ -228,8 +227,8 @@ const styles = StyleSheet.create({
marginBottom: 10,
marginHorizontal: 15,
borderLeftWidth: 4,
borderLeftColor: R.colors.blue,
shadowColor: R.colors.black,
borderLeftColor: R.colors.blue500,
shadowColor: R.colors.black250,
shadowOffset: {
width: 0,
height: 2,
......@@ -246,9 +245,9 @@ const styles = StyleSheet.create({
marginRight: 15,
},
eventTime: {
fontSize: R.fontsize.fontSizeContent,
fontFamily: R.fonts.fontMedium,
color: R.colors.blue,
fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.InterMedium,
color: R.colors.blue500,
fontWeight: '600',
},
// Container nội dung sự kiện
......@@ -256,16 +255,16 @@ const styles = StyleSheet.create({
flex: 1,
},
eventTitle: {
fontSize: R.fontsize.fontSizeContent,
fontFamily: R.fonts.fontMedium,
fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.InterRegular,
color: R.colors.black,
fontWeight: '600',
marginBottom: 4,
},
eventDescription: {
fontSize: R.fontsize.fontSizeContent,
fontFamily: R.fonts.fontRegular,
color: R.colors.gray2,
fontSize: R.fontsize.fontsSize12,
fontFamily: R.fonts.InterRegular,
color: R.colors.gray200,
fontWeight: '400',
},
});
......
......@@ -13,6 +13,7 @@ import R from '../../assets/R';
import { styles, CELL_WIDTH, BOTTOM_SHEET_HEIGHT } from './style';
import { useNavigation } from '@react-navigation/native';
import * as SCREENNAME from '../../routers/ScreenNames';
import { monthNames , weekDays, formatDateToString} from '../../config/Functions';
LogBox.ignoreAllLogs(
true
);
......@@ -36,11 +37,6 @@ const ClassScheduleView = ({
}) => {
const navigation = useNavigation();
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 (
<View style={styles.header}>
<TouchableOpacity
......@@ -63,8 +59,6 @@ const ClassScheduleView = ({
};
const renderWeekDays = () => {
const weekDays = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'];
return (
<View style={styles.weekDaysContainer}>
{weekDays.map((day, index) => (
......@@ -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 = () => {
......
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