import { styled } from 'styled-components';
import { TextInput, SelectInput, SearchBarAlert } from '../../../styles/Components';

const SearchBarLayout = ({ firstColumnData, secondColumnData, direction }) => {
	return (
		<SearchbarStyle direction={direction}>
			<SearchRow>
				{firstColumnData.map((data, index) => (
					<SearchItem key={index}>{data}</SearchItem>
				))}
			</SearchRow>
			{secondColumnData && (
				<SearchRow>
					{secondColumnData.map((data, index) => (
						<SearchItem key={index}>{data}</SearchItem>
					))}
				</SearchRow>
			)}
		</SearchbarStyle>
	);
};

export default SearchBarLayout;

const SearchbarStyle = styled.div`
	width: 100%;
	display: flex;
	flex-wrap: wrap;
	font-size: 14px;
	padding: 20px;
	border-top: 1px solid #000;
	border-bottom: 1px solid #000;
	margin: 0 0 40px;
	flex-flow: ${props => props.direction};
	gap: ${props => (props.direction === 'column' ? '20px' : '20px 0')};
`;

const SearchItem = styled.div`
	display: flex;
	align-items: center;
	gap: 20px;
	margin-right: 50px;

	${TextInput}, ${SelectInput} {
		height: 35px;
	}
	${TextInput} {
		padding: 0 10px;
		max-width: 400px;
	}
`;

const SearchRow = styled.div`
	display: flex;
	flex-wrap: wrap;
	gap: 20px 0;
`;
