application
This commit is contained in:
@@ -208,7 +208,7 @@
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
padding: 14px 16px 16px;
|
||||
background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
|
||||
background: linear-gradient(180deg, #c1d3da 0%, #9e6a6e 100%);
|
||||
}
|
||||
|
||||
.courses-page .course-card__tag {
|
||||
|
||||
+404
-3
@@ -461,7 +461,7 @@ button {
|
||||
border-radius: var(--radius-pill);
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
transition: color var(--transition), background-color var(--transition);
|
||||
@@ -1299,7 +1299,7 @@ button {
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
padding: 14px 16px 16px;
|
||||
background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
|
||||
background: linear-gradient(180deg, #c1d3da 0%, #9e6a6e 100%);
|
||||
}
|
||||
|
||||
#courses .course-card__tag {
|
||||
@@ -1615,7 +1615,7 @@ button {
|
||||
margin: 26px 0 0;
|
||||
color: var(--white);
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-size: 10.5px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 1.7;
|
||||
text-align: left;
|
||||
@@ -6055,4 +6055,405 @@ button {
|
||||
transform: none !important;
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
18. APPLICATION PAGE
|
||||
========================================================================== */
|
||||
|
||||
.application-page {
|
||||
position: relative;
|
||||
padding: calc(var(--header-h) + 72px) 0 110px;
|
||||
background:
|
||||
radial-gradient(circle at 18% 0%, rgba(215, 38, 61, 0.12), transparent 42%),
|
||||
radial-gradient(circle at 85% 20%, rgba(138, 138, 140, 0.08), transparent 38%),
|
||||
var(--bg);
|
||||
font-family: var(--font-main);
|
||||
}
|
||||
|
||||
.application-header {
|
||||
max-width: 700px;
|
||||
margin: 0 auto 44px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.application-title {
|
||||
color: var(--text);
|
||||
font-size: clamp(34px, 5vw, 54px);
|
||||
font-weight: 900;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.08;
|
||||
}
|
||||
|
||||
.application-subtitle {
|
||||
margin-top: 14px;
|
||||
color: var(--muted);
|
||||
font-size: 16px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.application-card {
|
||||
max-width: 860px;
|
||||
margin: 0 auto;
|
||||
padding: 46px 48px 48px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-lg);
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.application-card__title {
|
||||
margin-bottom: 30px;
|
||||
color: var(--text);
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.application-form {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.application-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 22px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.application-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 9px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.application-form > .application-field {
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.application-label {
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.application-required {
|
||||
color: #ff6b7d;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.application-input,
|
||||
.application-select,
|
||||
.application-textarea {
|
||||
width: 100%;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-sm);
|
||||
background-color: rgba(255, 255, 255, 0.045);
|
||||
color: var(--text);
|
||||
font-family: var(--font-main);
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
line-height: 1.45;
|
||||
transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.application-input::placeholder,
|
||||
.application-textarea::placeholder {
|
||||
color: rgba(255, 255, 255, 0.36);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.application-input:hover,
|
||||
.application-select:hover,
|
||||
.application-textarea:hover {
|
||||
border-color: rgba(255, 255, 255, 0.26);
|
||||
}
|
||||
|
||||
.application-input:focus,
|
||||
.application-select:focus,
|
||||
.application-textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
background-color: rgba(255, 255, 255, 0.06);
|
||||
box-shadow: 0 0 0 3px var(--accent-soft);
|
||||
}
|
||||
|
||||
.application-control {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.application-icon {
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--muted-2);
|
||||
pointer-events: none;
|
||||
transition: color var(--transition);
|
||||
}
|
||||
|
||||
.application-icon .icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.application-control .application-input {
|
||||
padding-left: 46px;
|
||||
}
|
||||
|
||||
.application-control:focus-within .application-icon {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.application-select {
|
||||
padding-right: 44px;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b5b5b5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 16px center;
|
||||
background-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.application-select option {
|
||||
background-color: var(--bg-alt);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.application-textarea {
|
||||
min-height: 118px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.application-error {
|
||||
display: none;
|
||||
color: #ff9aa6;
|
||||
font-size: 12.5px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.application-field.has-error .application-error {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.application-field.has-error .application-input,
|
||||
.application-field.has-error .application-select,
|
||||
.application-field.has-error .application-textarea {
|
||||
border-color: #ff5a6f;
|
||||
background-color: rgba(215, 38, 61, 0.08);
|
||||
}
|
||||
|
||||
.application-field.has-error .application-input:focus,
|
||||
.application-field.has-error .application-select:focus,
|
||||
.application-field.has-error .application-textarea:focus {
|
||||
box-shadow: 0 0 0 3px rgba(255, 90, 111, 0.16);
|
||||
}
|
||||
|
||||
.application-field.has-error .application-icon {
|
||||
color: #ff8b98;
|
||||
}
|
||||
|
||||
.application-field--check {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.application-check {
|
||||
display: inline-flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.application-check__input {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 2px 0 0;
|
||||
flex: none;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 5px;
|
||||
background-color: rgba(255, 255, 255, 0.045);
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 12px;
|
||||
transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.application-check__input:checked {
|
||||
border-color: var(--accent);
|
||||
background-color: var(--accent);
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.application-check__input:focus-visible {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--accent-soft);
|
||||
}
|
||||
|
||||
.application-field.has-error .application-check__input {
|
||||
border-color: #ff5a6f;
|
||||
}
|
||||
|
||||
.application-check__label {
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.application-actions {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.application-submit {
|
||||
width: 100%;
|
||||
padding: 17px 28px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.application-submit .icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.application-submit[disabled] {
|
||||
opacity: 0.65;
|
||||
cursor: wait;
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.application-hp {
|
||||
position: absolute !important;
|
||||
left: -9999px !important;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.application-alert {
|
||||
margin-bottom: 24px;
|
||||
padding: 14px 18px;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.application-alert--error {
|
||||
border: 1px solid rgba(255, 90, 111, 0.45);
|
||||
background: rgba(215, 38, 61, 0.12);
|
||||
color: #ffb3bd;
|
||||
}
|
||||
|
||||
.application-success {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 22px 8px 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.application-success__icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 78px;
|
||||
height: 78px;
|
||||
margin-bottom: 22px;
|
||||
border: 1px solid var(--accent-border);
|
||||
border-radius: 50%;
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.application-success__icon .icon {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.application-success__title {
|
||||
max-width: 560px;
|
||||
color: var(--text);
|
||||
font-size: clamp(23px, 3vw, 30px);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.application-success__text {
|
||||
max-width: 540px;
|
||||
margin-top: 14px;
|
||||
color: var(--muted);
|
||||
font-size: 15px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.application-success .btn {
|
||||
margin-top: 26px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.application-page {
|
||||
padding: calc(var(--header-h) + 48px) 0 80px;
|
||||
}
|
||||
|
||||
.application-header {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.application-card {
|
||||
padding: 30px 22px 32px;
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.application-row {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.application-form > .application-field {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.application-input,
|
||||
.application-select,
|
||||
.application-textarea {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.application-card {
|
||||
padding: 26px 16px 28px;
|
||||
}
|
||||
|
||||
.application-card__title {
|
||||
margin-bottom: 24px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.application-submit {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.application-input,
|
||||
.application-select,
|
||||
.application-textarea,
|
||||
.application-check__input,
|
||||
.application-icon {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -1394,3 +1394,221 @@
|
||||
initCtaSections();
|
||||
}
|
||||
})();
|
||||
|
||||
/* ==========================================================================
|
||||
APPLICATION FORM VALIDATION
|
||||
========================================================================== */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function initApplicationForm() {
|
||||
var form = document.querySelector('.application-form');
|
||||
|
||||
if (!form) {
|
||||
return;
|
||||
}
|
||||
|
||||
var submitButton = form.querySelector('.application-submit');
|
||||
var submitLabel = form.querySelector('.application-submit__label');
|
||||
var originalLabel = submitLabel ? submitLabel.textContent : 'Submit Application';
|
||||
|
||||
var rules = {
|
||||
full_name: function (input) {
|
||||
var value = input.value.trim();
|
||||
|
||||
if (!value) {
|
||||
return 'Please enter your full name.';
|
||||
}
|
||||
|
||||
if (value.length > 120) {
|
||||
return 'Please keep your full name under 120 characters.';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
phone: function (input) {
|
||||
var value = input.value.trim();
|
||||
|
||||
if (!value) {
|
||||
return 'Please enter your phone number.';
|
||||
}
|
||||
|
||||
if (!/^[0-9+\-()\s]+$/.test(value)) {
|
||||
return 'Please enter a valid phone number.';
|
||||
}
|
||||
|
||||
var digits = value.replace(/\D/g, '');
|
||||
|
||||
if (digits.length < 7) {
|
||||
return 'Please enter a valid phone number with at least 7 digits.';
|
||||
}
|
||||
|
||||
if (digits.length > 20) {
|
||||
return 'Please enter a phone number with no more than 20 digits.';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
email: function (input) {
|
||||
var value = input.value.trim();
|
||||
|
||||
if (!value) {
|
||||
return 'Please enter your email address.';
|
||||
}
|
||||
|
||||
if (value.length > 254 || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
||||
return 'Please enter a valid email address.';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
age: function (input) {
|
||||
var value = input.value.trim();
|
||||
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!/^\d+$/.test(value)) {
|
||||
return 'Age must be a number between 16 and 100.';
|
||||
}
|
||||
|
||||
var age = parseInt(value, 10);
|
||||
|
||||
if (age < 16 || age > 100) {
|
||||
return 'Age must be a number between 16 and 100.';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
terms: function (input) {
|
||||
if (!input.checked) {
|
||||
return 'Please agree to the Terms to continue.';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
function getField(input) {
|
||||
return input ? input.closest('.application-field') : null;
|
||||
}
|
||||
|
||||
function setError(name, message) {
|
||||
var input = form.querySelector('[name="' + name + '"]');
|
||||
var field = getField(input);
|
||||
var error = form.querySelector('[data-error-for="' + name + '"]');
|
||||
|
||||
if (field) {
|
||||
field.classList.toggle('has-error', Boolean(message));
|
||||
}
|
||||
|
||||
if (input) {
|
||||
input.setAttribute('aria-invalid', message ? 'true' : 'false');
|
||||
}
|
||||
|
||||
if (error) {
|
||||
error.textContent = message;
|
||||
}
|
||||
}
|
||||
|
||||
function validateField(input) {
|
||||
var rule = rules[input.name];
|
||||
|
||||
if (!rule) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var message = rule(input);
|
||||
setError(input.name, message);
|
||||
|
||||
return !message;
|
||||
}
|
||||
|
||||
Object.keys(rules).forEach(function (name) {
|
||||
var input = form.querySelector('[name="' + name + '"]');
|
||||
|
||||
if (!input) {
|
||||
return;
|
||||
}
|
||||
|
||||
input.addEventListener('blur', function () {
|
||||
var field = getField(input);
|
||||
|
||||
if (field && (field.classList.contains('has-error') || input.value.trim() !== '')) {
|
||||
validateField(input);
|
||||
}
|
||||
});
|
||||
|
||||
input.addEventListener('input', function () {
|
||||
var field = getField(input);
|
||||
|
||||
if (field && field.classList.contains('has-error')) {
|
||||
validateField(input);
|
||||
}
|
||||
});
|
||||
|
||||
input.addEventListener('change', function () {
|
||||
var field = getField(input);
|
||||
|
||||
if (field && field.classList.contains('has-error')) {
|
||||
validateField(input);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.addEventListener('submit', function (event) {
|
||||
var firstInvalid = null;
|
||||
|
||||
Object.keys(rules).forEach(function (name) {
|
||||
var input = form.querySelector('[name="' + name + '"]');
|
||||
|
||||
if (!input) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!validateField(input) && !firstInvalid) {
|
||||
firstInvalid = input;
|
||||
}
|
||||
});
|
||||
|
||||
if (firstInvalid) {
|
||||
event.preventDefault();
|
||||
firstInvalid.focus();
|
||||
|
||||
if (firstInvalid.scrollIntoView) {
|
||||
firstInvalid.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (submitButton) {
|
||||
submitButton.disabled = true;
|
||||
submitButton.setAttribute('aria-busy', 'true');
|
||||
}
|
||||
|
||||
if (submitLabel) {
|
||||
submitLabel.textContent = 'Submitting...';
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('pageshow', function () {
|
||||
if (submitButton) {
|
||||
submitButton.disabled = false;
|
||||
submitButton.removeAttribute('aria-busy');
|
||||
}
|
||||
|
||||
if (submitLabel) {
|
||||
submitLabel.textContent = originalLabel;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initApplicationForm);
|
||||
} else {
|
||||
initApplicationForm();
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user