style(calendar): add styling to the ui

This commit is contained in:
ryan 2025-02-26 14:38:46 +03:00
parent 869beeb3d4
commit ce8c6e66a5
3 changed files with 170 additions and 72 deletions

View file

@ -4,45 +4,46 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calendar Merger</title> <title>Calendar Merger</title>
<style> <link rel="stylesheet" href="styles.css">
body {
font-family: Arial, sans-serif;
}
#calendars {
margin-bottom: 20px;
}
#calendars .calendar {
margin-bottom: 10px;
}
#calendars .calendar input[type="text"] {
width: 50%;
margin-right: 10px;
}
#calendars .calendar input[type="url"] {
width: 50%;
}
#add-calendar {
margin-bottom: 20px;
}
</style>
</head> </head>
<body> <body>
<h1>Calendar Merger</h1> <div class="container">
<form id="merge-form"> <h1>📅 Calendar Merger</h1>
<input type="text" id="link-group-name" placeholder="Link Group Name">
<div id="calendars"> <div class="form-card">
<div class="calendar"> <form id="merge-form">
<input type="text" id="prefix-0" placeholder="Prefix"> <div class="input-group">
<input type="text"
id="link-group-name"
placeholder="Enter collection name"
class="input-field">
</div>
<div id="calendars">
<div class="calendar-entry">
<input type="text" id="prefix-0" placeholder="Event prefix">
<input type="url" id="url-0" placeholder="https://example.com/calendar.ics">
<div class="checkbox-group">
<input type="checkbox" id="override-0"> <input type="checkbox" id="override-0">
<label for="override-0">Override</label> <label for="override-0">Override</label>
<input type="url" id="url-0" placeholder="Calendar URL"> </div>
</div> </div>
</div> </div>
<button id="add-calendar" type="button">Add Calendar</button>
<button type="submit">Merge Calendars</button> <div class="button-group">
</form> <button type="button" id="add-calendar" class="button secondary-btn">
<div id="result"></div> Add Another Calendar
</button>
<button type="submit" class="button primary-btn">
🔗 Merge Calendars
</button>
</div>
</form>
</div>
<div id="result"></div>
</div>
<script src="script.js"></script> <script src="script.js"></script>
</body> </body>
</html> </html>

View file

@ -14,12 +14,12 @@ function isValidUrl(url) {
addCalendarButton.addEventListener('click', () => { addCalendarButton.addEventListener('click', () => {
const newCalendar = document.createElement('div'); const newCalendar = document.createElement('div');
newCalendar.className = 'calendar'; newCalendar.className = 'calendar-entry';
newCalendar.innerHTML = ` newCalendar.innerHTML = `
<input type="text" id="prefix-${calendarIndex}" placeholder="Prefix"> <input type="text" id="prefix-${calendarIndex}" placeholder="Event prefix">
<input type="url" id="url-${calendarIndex}" placeholder="https://example.com/calendar.ics">
<input type="checkbox" id="override-${calendarIndex}"> <input type="checkbox" id="override-${calendarIndex}">
<label for="override-${calendarIndex}">Override</label> <label for="override-${calendarIndex}">Override</label>
<input type="url" id="url-${calendarIndex}" placeholder="Calendar URL">
`; `;
calendars.appendChild(newCalendar); calendars.appendChild(newCalendar);
calendarIndex++; calendarIndex++;

View file

@ -1,37 +1,134 @@
body { :root {
font-family: Arial, sans-serif; --primary: #2563eb;
} --primary-hover: #1d4ed8;
--background: #f8fafc;
#merge-form { --surface: #ffffff;
max-width: 400px; --border: #e2e8f0;
margin: 40px auto; --text: #1e293b;
padding: 20px; }
border: 1px solid #ccc;
border-radius: 10px; body {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); font-family: 'Segoe UI', system-ui, sans-serif;
} background: var(--background);
color: var(--text);
label { line-height: 1.6;
display: block; margin: 0;
margin-bottom: 10px; padding: 2rem;
} }
input[type="url"], input[type="text"] { .container {
max-width: 800px;
margin: 0 auto;
}
/* Form Styling */
.form-card {
background: var(--surface);
border-radius: 12px;
padding: 2rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
}
.input-group {
display: grid;
gap: 1rem;
margin-bottom: 1.5rem;
}
/* Calendar Entry Styling */
.calendar-entry {
display: flex;
gap: 1rem;
align-items: center;
padding: 1rem;
background: var(--background);
border-radius: 8px;
transition: all 0.2s ease;
margin-bottom: 1rem;
}
.calendar-entry:hover {
transform: translateY(-2px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
/* Input Elements */
input[type="text"],
input[type="url"] {
padding: 0.75rem;
border: 2px solid var(--border);
border-radius: 6px;
width: 100%; width: 100%;
padding: 10px; transition: border-color 0.2s ease;
margin-bottom: 20px; }
border: 1px solid #ccc;
} input:focus {
outline: none;
button[type="submit"] { border-color: var(--primary);
background-color: #4CAF50; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
color: #fff; }
padding: 10px 20px;
/* Checkbox Styling */
.checkbox-group {
display: flex;
align-items: center;
gap: 0.5rem;
}
input[type="checkbox"] {
width: 1.2em;
height: 1.2em;
accent-color: var(--primary);
}
/* Button Styling */
.button {
padding: 0.75rem 1.5rem;
border: none; border: none;
border-radius: 5px; border-radius: 6px;
cursor: pointer; cursor: pointer;
} font-weight: 600;
transition: all 0.2s ease;
button[type="submit"]:hover { }
background-color: #3e8e41;
} .primary-btn {
background: var(--primary);
color: white;
}
.primary-btn:hover {
background: var(--primary-hover);
}
.secondary-btn {
background: var(--background);
border: 2px solid var(--border);
}
/* Result Display */
#result {
padding: 1.5rem;
background: var(--surface);
border-radius: 8px;
margin-top: 1rem;
border: 2px dashed var(--border);
}
#result a {
color: var(--primary);
text-decoration: none;
font-weight: 500;
}
/* Responsive Design */
@media (max-width: 640px) {
.calendar-entry {
flex-direction: column;
align-items: stretch;
}
input[type="text"] {
width: 100%;
}
}