placeHolder, label undefined시 조건추가가

This commit is contained in:
YangJinSoo94
2025-03-05 18:17:36 +09:00
parent 9b44458a12
commit 6fe828d77f
@@ -23,12 +23,14 @@ interface SelectBox1 {
} }
function SelectBox(props: {label : string, selectArray: SelectBox1[]}){ function SelectBox(props: {label : string, selectArray: SelectBox1[]}){
const placeHolder = props.selectArray.length > 0 ? props.selectArray[0].text : "";
return ( return (
<div style={styles.selectBoxDiv}> <div style={styles.selectBoxDiv}>
<Label style={styles.labelStyle}>{props.label}</Label> {props.label && <Label style={styles.labelStyle}>{props.label}</Label>}
<Select style={styles.selectStyle}> <Select style={styles.selectStyle}>
<SelectTrigger style={styles.selectStyle} className="w-[180px]"> <SelectTrigger style={styles.selectStyle} className="w-[180px]">
<SelectValue placeholder="Theme" /> <SelectValue placeholder={placeHolder} />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
{props.selectArray.map((selectArray) => ( {props.selectArray.map((selectArray) => (