UNPKG

@truconsent/consent-banner-react

Version:

React consent-banner components (in-page & modal)

956 lines (822 loc) 15.2 kB
/* ================= RESET & BASE STYLES ================ */ * { box-sizing: border-box; } .rc-container { max-width: 1200px; margin: 0 auto; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8fafc; min-height: 100vh; } /* ================= TABS ================ */ .rc-tabs { display: flex; gap: 4px; margin-bottom: 24px; justify-content: center; flex-wrap: wrap; } .rc-tab { padding: 12px 24px; border: none; border-radius: 8px; background: #ffffff; color: #6b7280; font-weight: 500; font-size: 14px; cursor: pointer; transition: all 0.2s ease; border: 1px solid #e5e7eb; } .rc-tab:hover { background: #f3f4f6; color: #374151; } .rc-tab-active { background: #3b82f6; color: white; border-color: #3b82f6; } /* ================= PRINCIPAL ID ================ */ .rc-principal-id { display: flex; align-items: center; gap: 8px; background: #dbeafe; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 16px; margin-bottom: 32px; } .rc-principal-icon { color: #3b82f6; width: 20px; height: 20px; } .rc-principal-text { color: #1e40af; font-weight: 500; font-size: 14px; } /* ================= CONTENT WRAPPER ================ */ .rc-content { background: white; border-radius: 12px; padding: 32px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); border: 1px solid #e5e7eb; } /* ================= TYPOGRAPHY ================ */ .rc-section-title { font-size: 24px; font-weight: 700; color: #111827; margin: 0 0 8px 0; } .rc-section-subtitle { font-size: 16px; color: #6b7280; margin: 0 0 24px 0; } /* ================= SECTION HEADER ================ */ .rc-section-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; } /* ================= BUTTONS ================ */ .rc-btn-primary { background: #3b82f6; color: white; border: none; padding: 12px 20px; border-radius: 8px; font-weight: 500; font-size: 14px; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 8px; } .rc-btn-primary:hover { background: #2563eb; } .rc-btn-secondary { background: white; color: #374151; border: 1px solid #d1d5db; padding: 12px 20px; border-radius: 8px; font-weight: 500; font-size: 14px; cursor: pointer; transition: all 0.2s ease; } .rc-btn-secondary:hover { background: #f9fafb; border-color: #9ca3af; } .rc-btn-danger { background: white; color: #dc2626; border: 1px solid #dc2626; padding: 12px 20px; border-radius: 8px; font-weight: 500; font-size: 14px; cursor: pointer; transition: all 0.2s ease; } .rc-btn-danger:hover { background: #fef2f2; } .rc-btn-icon { width: 16px; height: 16px; } /* ================= CONSENT SECTION ================ */ .rc-consent-list { display: flex; flex-direction: column; gap: 24px; } .rc-consent-item { border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px; background: #ffffff; position: relative; } .rc-consent-header { margin-bottom: 16px; } .rc-consent-title-row { display: flex; align-items: flex-start; justify-content: space-around; margin-bottom: 12px; } .rc-consent-title { font-size: 18px; font-weight: 600; color: #111827; margin: 0; flex: 1; } .rc-consent-header-right { display: flex; align-items: center; /* margin-right: 70px; */ gap: 12px; } .rc-info-icon { color: #6b7280; width: 20px; height: 20px; cursor: pointer; transition: color 0.2s ease; } .rc-info-icon:hover { color: #374151; } .rc-badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; } .rc-badge-mandatory { background: #fecaca; color: #991b1b; } .rc-badge-optional { background: #d1fae5; color: #065f46; } .rc-consent-description { font-size: 14px; color: #6b7280; margin: 0 0 16px 0; line-height: 1.5; } .rc-consent-details { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; } .rc-detail-item { display: flex; gap: 8px; font-size: 14px; } .rc-detail-label { font-weight: 500; color: #374151; min-width: 120px; } .rc-detail-value { color: #6b7280; } .rc-consent-status { display: flex; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; } .rc-status-item { display: flex; align-items: center; gap: 8px; font-size: 14px; } .rc-status-label { color: #374151; font-weight: 500; } .rc-status-pill { padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; } .rc-status-yes { background: #d1fae5; color: #065f46; } .rc-status-no { background: #fef2f2; color: #991b1b; } /* ================= TOGGLE SWITCH ================ */ .rc-consent-toggle { position: absolute; top: 50%; right: 24px; } .rc-switch { position: relative; display: inline-block; width: 50px; height: 24px; } .rc-switch input { opacity: 0; width: 0; height: 0; } .rc-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e0; transition: 0.4s; border-radius: 24px; } .rc-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: 0.4s; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); } input:checked + .rc-slider { background-color: #3b82f6; } input:checked + .rc-slider:before { transform: translateX(26px); } /* ================= RIGHTS SECTION ================ */ .rc-rights-actions { display: flex; gap: 16px; flex-wrap: wrap; } /* ================= TRANSPARENCY SECTION ================ */ .rc-transparency-text { font-size: 16px; color: #374151; line-height: 1.6; margin: 0; } /* ================= DPO SECTION ================ */ .rc-dpo-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; } .rc-dpo-icon { color: #3b82f6; width: 24px; height: 24px; } .rc-dpo-content { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 32px; } .rc-dpo-left, .rc-dpo-right { display: flex; flex-direction: column; gap: 20px; } .rc-dpo-item { display: flex; align-items: flex-start; gap: 12px; } .rc-dpo-item-icon { color: #6b7280; width: 20px; height: 20px; margin-top: 2px; } .rc-dpo-item div { display: flex; flex-direction: column; gap: 4px; } .rc-dpo-label { font-size: 14px; font-weight: 500; color: #374151; } .rc-dpo-value { font-size: 14px; color: #6b7280; } .rc-dpo-info-item { display: flex; flex-direction: column; gap: 4px; } .rc-dpo-time-icon { color: #6b7280; width: 16px; height: 16px; } .rc-response-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 16px; margin-top: 8px; } .rc-response-title { font-size: 16px; font-weight: 600; color: #1e40af; margin: 0 0 8px 0; } .rc-response-text { font-size: 14px; color: #1e40af; margin: 0; line-height: 1.5; } /* ================= NOMINEE SECTION ================ */ .rc-nominee-details-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 32px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 24px; margin-top: 16px; } /* each icon + label/value pair */ .rc-nominee-item { display: flex; align-items: flex-start; gap: 12px; } /* force a row to span both columns */ .rc-nominee-fullwidth { grid-column: 1 / -1; } /* icon styling */ .rc-nominee-icon { flex-shrink: 0; width: 20px; height: 20px; color: #6b7280; } /* labels are bold, smaller text */ .rc-nominee-label { display: block; font-size: 0.875rem; font-weight: 600; color: #374151; } /* values are regular weight, muted color */ .rc-nominee-value { display: block; font-size: 0.875rem; color: #6b7280; margin-top: 2px; } /* full-width action buttons under grid */ .rc-nominee-actions-fullwidth { grid-column: 1 / -1; display: flex; gap: 16px; margin-top: 16px; justify-content: flex-start; } /* reuse your existing btn-danger override, if needed */ .rc-btn-danger { background: #dc2626; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; } .rc-btn-danger:hover { background: #b91c1c; } /* Danger button (delete) */ .rc-btn-danger { background: #dc2626; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; } .rc-btn-danger:hover { background: #b91c1c; } .rc-nominee-warning { display: flex; align-items: flex-start; gap: 12px; background: #fef3c7; border: 1px solid #fbbf24; border-radius: 8px; padding: 16px; margin-bottom: 24px; } .rc-warning-icon { font-size: 20px; margin-top: 2px; } .rc-nominee-warning p { font-size: 14px; color: #92400e; margin: 0; line-height: 1.5; } .rc-nominee-form { display: flex; flex-direction: column; gap: 20px; } .rc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } .rc-form-group { display: flex; flex-direction: column; gap: 8px; } .rc-form-label { font-size: 14px; font-weight: 500; color: #374151; } .rc-form-input, .rc-form-select, .rc-form-textarea { padding: 12px 16px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; transition: border-color 0.2s ease; } .rc-form-input:focus, .rc-form-select:focus, .rc-form-textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); } .rc-form-textarea { resize: vertical; font-family: inherit; } .rc-form-actions { display: flex; gap: 12px; justify-content: flex-start; margin-top: 8px; } /* ================= GRIEVANCE SECTION ================ */ .rc-grievance-form { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px; margin-bottom: 32px; display: flex; flex-direction: column; gap: 20px; } .rc-tickets-section { margin-top: 32px; } .rc-tickets-title { font-size: 18px; font-weight: 600; color: #111827; margin: 0 0 16px 0; } .rc-empty-state { text-align: center; padding: 40px 20px; color: #6b7280; } .rc-ticket-list { display: flex; flex-direction: column; gap: 16px; } .rc-ticket-item { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; } .rc-ticket-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .rc-ticket-subject { font-size: 16px; font-weight: 600; color: #111827; margin: 0; } .rc-ticket-status { background: #d1fae5; color: #065f46; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; text-transform: uppercase; } .rc-ticket-description { font-size: 14px; color: #6b7280; margin: 0; line-height: 1.5; } /* ================= MODAL ================ */ .rc-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; padding: 24px; z-index: 1000; } .rc-modal { background: white; border-radius: 12px; padding: 32px; max-width: 700px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); } .rc-modal-small { max-width: 400px; } .rc-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; } .rc-modal-title { font-size: 20px; font-weight: 700; color: #111827; margin: 0; } .rc-modal-close { background: #f3f4f6; border: none; cursor: pointer; padding: 8px; border-radius: 6px; color: #6b7280; transition: all 0.2s ease; } .rc-modal-close:hover { background: #e5e7eb; color: #374151; } .rc-modal-subtitle { font-size: 14px; color: #6b7280; margin-bottom: 24px; } .rc-modal-content { display: flex; flex-direction: column; gap: 24px; } .rc-modal-section { padding: 20px; background: #f8fafc; border-radius: 8px; border: 1px solid #e5e7eb; } .rc-modal-section-title { font-size: 16px; font-weight: 600; color: #111827; margin: 0 0 16px 0; } .rc-modal-field { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; font-size: 14px; } .rc-modal-field-label { min-width: 140px; color: #374151; } .rc-modal-field-value { color: #6b7280; flex: 1; } .rc-elements-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 16px; } .rc-element-card { background: white; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; } .rc-element-title { font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 8px; display: block; } .rc-element-description { font-size: 13px; color: #6b7280; margin: 0; line-height: 1.4; } .rc-modal-status-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; } .rc-modal-status-label { color: #374151; font-weight: 500; } .rc-modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; } .rc-modal-success { text-align: center; padding: 32px; } .rc-success-icon { color: #10b981; width: 48px; height: 48px; margin-bottom: 16px; } /* ================= RESPONSIVE DESIGN ================ */ @media (max-width: 768px) { .rc-container { padding: 16px; } .rc-content { padding: 24px 20px; } .rc-section-header { flex-direction: column; align-items: stretch; gap: 16px; } .rc-tabs { flex-wrap: wrap; justify-content: center; } .rc-consent-status { flex-direction: column; gap: 8px; } .rc-consent-toggle { position: static; margin-top: 16px; display: flex; justify-content: flex-end; } .rc-rights-actions { flex-direction: column; } .rc-dpo-content { grid-template-columns: 1fr; gap: 24px; } .rc-form-row { grid-template-columns: 1fr; } .rc-modal { margin: 16px; padding: 24px; } .rc-elements-grid { grid-template-columns: 1fr; } } @media (max-width: 480px) { .rc-section-title { font-size: 20px; } .rc-tab { padding: 10px 16px; font-size: 13px; } .rc-modal { margin: 8px; padding: 20px; } .rc-form-actions { flex-direction: column; } } .rc-empty-state { display: flex; align-items: center; justify-content: center; gap: 8px; background: #f9fafb; border: 1px dashed #e5e7eb; border-radius: 6px; color: #6b7280; font-style: italic; padding: 16px; margin: 16px 0; } .rc-empty-state-icon { width: 20px; height: 20px; color: #2563eb; }