feat: create index page
This commit is contained in:
1 parent
19d2d191d0
commit
e5e66b2953
1 file changed
+96
-2
+96
-2
@@ -1,7 +1,101 @@
|
||||
import Image from "next/image";
|
||||
"use client"
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function Home() {
|
||||
const [icalLink, setIcalLink] = useState('');
|
||||
const [days, setDays] = useState<number | string>(7) // standart: 7 days
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault(); // website won't reload
|
||||
|
||||
if (!icalLink) {
|
||||
return;
|
||||
}
|
||||
|
||||
//const encodedLink = encodeURIComponent(icalLink.trim());
|
||||
|
||||
router.push(`/evaluation?days=${days}&ical-link=${icalLink}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<p>hi</p>
|
||||
<main
|
||||
style={{
|
||||
width: '100%',
|
||||
maxWidth: '800px',
|
||||
margin: '0 auto',
|
||||
padding: '1rem',
|
||||
boxSizing: 'border-box',
|
||||
fontFamily: 'system-ui, sans-serif',
|
||||
}}
|
||||
>
|
||||
<section style={{ marginBottom: '2.5rem' }}>
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
style={{ display: 'flex', flexDirection: 'column', gap: '1rem', maxWidth: '400px' }}
|
||||
>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.3rem' }}>
|
||||
<label htmlFor="ical-link-input" style={{ fontWeight: 600 }}>
|
||||
iCal-Link
|
||||
</label>
|
||||
<input
|
||||
type="url"
|
||||
id="ical-link-input"
|
||||
value={icalLink}
|
||||
onChange={(e) => setIcalLink(e.target.value)}
|
||||
placeholder="https://example.com/calendar.ics"
|
||||
required
|
||||
style={{
|
||||
padding: '0.5rem',
|
||||
borderRadius: '4px',
|
||||
border: '1px solid #ccc',
|
||||
fontSize: '1rem',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.3rem' }}>
|
||||
<label htmlFor="days-input" style={{ fontWeight: 600 }}>
|
||||
Anzahl der betrachteten Tage
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="days-input"
|
||||
min={1}
|
||||
value={days}
|
||||
onChange={(e) => setDays(Number(e.target.value) || '')}
|
||||
placeholder="7"
|
||||
required
|
||||
style={{
|
||||
padding: '0.5rem',
|
||||
borderRadius: '4px',
|
||||
border: '1px solid #ccc',
|
||||
fontSize: '1rem',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
style={{
|
||||
marginTop: '0.5rem',
|
||||
padding: '0.75rem',
|
||||
backgroundColor: '#3b82f6',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
borderRadius: '4px',
|
||||
fontSize: '1rem',
|
||||
fontWeight: 600,
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
Zu den Diagrammen
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user