New favicon and FlatDetails card
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.3 KiB |
23
src/App.js
23
src/App.js
@@ -2,12 +2,7 @@ import { React, useState } from 'react';
|
||||
|
||||
import {
|
||||
ChakraProvider,
|
||||
Box,
|
||||
Text,
|
||||
Link,
|
||||
VStack,
|
||||
Code,
|
||||
Grid,
|
||||
theme,
|
||||
Select,
|
||||
Card,
|
||||
@@ -15,7 +10,10 @@ import {
|
||||
Heading,
|
||||
CardBody,
|
||||
Center,
|
||||
SimpleGrid,
|
||||
} from '@chakra-ui/react';
|
||||
|
||||
import { FlatDetails } from './Solimieten';
|
||||
import { ColorModeSwitcher } from './ColorModeSwitcher';
|
||||
import { flatData } from './Data';
|
||||
|
||||
@@ -23,6 +21,7 @@ function App() {
|
||||
const [levelOptions, setLevelOption] = useState([{ value: 0, label: "EG" }, { value: 1, label: "1. OG" }, { value: 2, label: "2. OG" }, { value: 3, label: "3. OG" }]);
|
||||
const [flatOptions, setFlatOptions] = useState([]);
|
||||
const [selectedBuilding, setSelectedBuilding] = useState();
|
||||
const [selectedFlat, setSelectedFlat] = useState();
|
||||
|
||||
function buildingSelected(e) {
|
||||
var newOptions;
|
||||
@@ -42,10 +41,18 @@ function App() {
|
||||
setFlatOptions(flatData[selectedBuilding][e.target.value]);
|
||||
}
|
||||
}
|
||||
|
||||
function flatSelected(e) {
|
||||
var index = e.target.value;
|
||||
|
||||
setSelectedFlat(flatOptions[index]);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
<ChakraProvider theme={theme}>
|
||||
<Center>
|
||||
<SimpleGrid columns={2} spacing={4}>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<Heading size='md'>Wohnungsauswahl</Heading>
|
||||
@@ -59,11 +66,13 @@ function App() {
|
||||
<Select placeholder='Etage auswählen' onChange={levelSelected}>
|
||||
{levelOptions.map(({ value, label }, index) => <option value={value} >{label}</option>)}
|
||||
</Select>
|
||||
<Select placeholder='Wohnung auswählen'>
|
||||
{flatOptions.map((flat) => <option value={flat} >{flat.print()}</option>)}
|
||||
<Select placeholder='Wohnung auswählen' onChange={flatSelected}>
|
||||
{flatOptions.map((flat, index) => <option value={index} >{flat.print()}</option>)}
|
||||
</Select>
|
||||
</CardBody>
|
||||
</Card>
|
||||
<FlatDetails flat={selectedFlat} />
|
||||
</SimpleGrid>
|
||||
</Center>
|
||||
</ChakraProvider >
|
||||
);
|
||||
|
||||
73
src/Solimieten.js
Normal file
73
src/Solimieten.js
Normal file
@@ -0,0 +1,73 @@
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
Heading,
|
||||
CardBody,
|
||||
Stack,
|
||||
StackDivider,
|
||||
Box,
|
||||
Text,
|
||||
Badge
|
||||
} from '@chakra-ui/react';
|
||||
|
||||
export function FlatDetails({ flat }) {
|
||||
var body = <CardBody>
|
||||
Bitte auswählen
|
||||
</CardBody>;
|
||||
|
||||
var badges = "";
|
||||
|
||||
if (flat) {
|
||||
body = <CardBody>
|
||||
|
||||
<Stack divider={<StackDivider />} spacing='4'>
|
||||
|
||||
<Box>
|
||||
<Heading size='xs' textTransform='uppercase'>
|
||||
Bezeichnung
|
||||
</Heading>
|
||||
<Text pt='2' fontSize='sm'>
|
||||
{flat.name}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Heading size='xs' textTransform='uppercase'>
|
||||
Zimmeranzahl
|
||||
</Heading>
|
||||
<Text pt='2' fontSize='sm'>
|
||||
{flat.numRooms}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Heading size='xs' textTransform='uppercase'>
|
||||
Private Fläche
|
||||
</Heading>
|
||||
<Text pt='2' fontSize='sm'>
|
||||
{flat.sizePrivate} m²
|
||||
</Text>
|
||||
</Box>
|
||||
</Stack>
|
||||
</CardBody>;
|
||||
|
||||
if (flat.isWbs) {
|
||||
badges = <Badge colorScheme='blue'>
|
||||
mit WBS
|
||||
</Badge>;
|
||||
} else {
|
||||
badges = <Badge colorScheme='yellow'>
|
||||
ohne WBS
|
||||
</Badge>;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Card>
|
||||
|
||||
<CardHeader>
|
||||
{badges}
|
||||
<Heading size='md'>Wohnungsdetails</Heading>
|
||||
</CardHeader>
|
||||
{body}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user