upd: discussion
Deskripsi: - ui list diskusi No Issues
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import React from "react";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import LabelStatus from "./labelStatus";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
|
||||
type Props = {
|
||||
title: string
|
||||
subtitle?: string
|
||||
subtitle?: string | React.ReactNode
|
||||
icon: React.ReactNode
|
||||
desc?: string
|
||||
rightTopInfo?: string
|
||||
onPress?: () => void
|
||||
borderType: 'all' | 'bottom'
|
||||
leftBottomInfo?: React.ReactNode | string
|
||||
rightBottomInfo?: React.ReactNode | string
|
||||
}
|
||||
|
||||
export default function BorderBottomItem({ title, subtitle, icon, desc, onPress, rightTopInfo, borderType }: Props) {
|
||||
export default function BorderBottomItem({ title, subtitle, icon, desc, onPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo }: Props) {
|
||||
|
||||
console.log(typeof rightBottomInfo)
|
||||
return (
|
||||
<Pressable style={[borderType == 'bottom' ? Styles.wrapItemBorderBottom : Styles.wrapItemBorderAll]} onPressOut={onPress}>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
@@ -19,7 +26,14 @@ export default function BorderBottomItem({ title, subtitle, icon, desc, onPress,
|
||||
<View style={[Styles.rowSpaceBetween, { width: '85%' }]}>
|
||||
<View style={[Styles.ml10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>{title}</Text>
|
||||
{subtitle && <Text style={[Styles.textMediumNormal, {lineHeight:15}]}>{subtitle}</Text>}
|
||||
{
|
||||
subtitle &&
|
||||
typeof subtitle == "string"
|
||||
? <Text style={[Styles.textMediumNormal, { lineHeight: 15 }]}>{subtitle}</Text>
|
||||
: <View style={{ alignItems: 'flex-start' }}>
|
||||
{subtitle}
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
{
|
||||
rightTopInfo && <Text style={[Styles.textInformation]}>{rightTopInfo}</Text>
|
||||
@@ -28,6 +42,25 @@ export default function BorderBottomItem({ title, subtitle, icon, desc, onPress,
|
||||
|
||||
</View>
|
||||
{desc && <Text style={[Styles.textDefault, Styles.mt05, { textAlign: 'justify' }]}>{desc}</Text>}
|
||||
{
|
||||
leftBottomInfo && rightBottomInfo &&
|
||||
(
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mt10]}>
|
||||
{
|
||||
typeof leftBottomInfo == 'string' ?
|
||||
<Text style={[Styles.textInformation, Styles.cGray, { textAlign: 'left' }]}>{leftBottomInfo}</Text>
|
||||
:
|
||||
leftBottomInfo
|
||||
}
|
||||
{
|
||||
typeof rightBottomInfo == 'string' ?
|
||||
<Text style={[Styles.textInformation, Styles.cGray, { textAlign: 'right' }]}>{rightBottomInfo}</Text>
|
||||
:
|
||||
rightBottomInfo
|
||||
}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
40
components/discussion_general/headerDiscussionGeneral.tsx
Normal file
40
components/discussion_general/headerDiscussionGeneral.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import Styles from "@/constants/Styles"
|
||||
import { AntDesign } from "@expo/vector-icons"
|
||||
import { router } from "expo-router"
|
||||
import { useState } from "react"
|
||||
import { View } from "react-native"
|
||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||
import DrawerBottom from "../drawerBottom"
|
||||
import MenuItemRow from "../menuItemRow"
|
||||
import ModalFilter from "../modalFilter"
|
||||
|
||||
export default function HeaderDiscussionGeneral() {
|
||||
const [isVisible, setVisible] = useState(false)
|
||||
const [isFilter, setFilter] = useState(false)
|
||||
return (
|
||||
<>
|
||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
||||
title="Tambah Diskusi"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
router.push('/discussion/create')
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<AntDesign name="filter" color="black" size={25} />}
|
||||
title="Filter"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setFilter(true)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
<ModalFilter close={() => { setFilter(false) }} open={isFilter} page="discussion" />
|
||||
</>
|
||||
)
|
||||
}
|
||||
17
components/labelStatus.tsx
Normal file
17
components/labelStatus.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { Text, View } from "react-native";
|
||||
|
||||
|
||||
type Props = {
|
||||
category: 'error' | 'success' | 'warning' | 'primary'
|
||||
text: string
|
||||
size: 'small' | 'default'
|
||||
}
|
||||
export default function LabelStatus({ category, text, size }: Props) {
|
||||
return (
|
||||
<View style={[size == "small" ? Styles.labelStatusSmall : Styles.labelStatus, ColorsStatus[category]]}>
|
||||
<Text style={[size == "small" ? Styles.textSmallSemiBold : Styles.textMediumSemiBold, Styles.cWhite, { textAlign: 'center' }]}>{text}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { router } from "expo-router"
|
||||
type Props = {
|
||||
open: boolean,
|
||||
close: (value: boolean) => void
|
||||
page: 'position' | 'member'
|
||||
page: 'position' | 'member' | 'discussion'
|
||||
}
|
||||
|
||||
export default function ModalFilter({ open, close, page }: Props) {
|
||||
|
||||
Reference in New Issue
Block a user