Siteβ―Builder
Editing:
social-links2.html
writable 0666
<!doctype html> <meta charset="utf-8"> <title>Add social links βΒ Demo</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <style> :root{ --brand:#0066ff;--bg:#f7f9ff;--fg:#111;--chip:#e7edff; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif; } *{box-sizing:border-box} body{margin:0;min-height:100vh;display:grid;place-content:center;background:var(--bg);color:var(--fg)} .card{width:clamp(320px,92vw,560px);background:#fff;padding:2.2rem;border-radius:14px; box-shadow:0 8px 28px rgba(0,0,0,.07)} h1{margin-top:0;font-size:1.9rem;text-align:center;color:var(--brand)} select,button{width:100%;padding:.65rem .75rem;font:inherit;border:1px solid #c9d3e6; border-radius:8px} button{margin-top:1.2rem;background:var(--brand);color:#fff;border:none;font-weight:600;cursor:pointer} button:hover{filter:brightness(1.09)} .tags{display:flex;flex-wrap:wrap;gap:.55rem;margin-top:1.4rem} .tag{display:inline-flex;align-items:center;gap:.4rem;background:var(--chip);padding:.35rem .8rem; border-radius:18px;font-size:.88rem} .tag svg{width:17px;height:17px} .tag .x{color:#d91c31;font-weight:700;cursor:pointer;line-height:0} textarea{display:none} @media(prefers-color-scheme:dark){ :root{--bg:#0d1117;--fg:#e6edf3;--brand:#2f81f7;--chip:#26334d} .card{background:#161b22;box-shadow:0 6px 22px rgba(0,0,0,.6)} select,button{border-color:#394150;background:#0d1117;color:var(--fg)} } </style> <div class="card"> <h1>Add your social links</h1> <select id="platform"> <option value="">Choose a platformβ¦</option> <option value="twitter">X / Twitter</option> <option value="facebook">Facebook</option> <option value="instagram">Instagram</option> <option value="linkedin">LinkedIn</option> <option value="youtube">YouTube</option> <option value="pinterest">Pinterest</option> <option value="tiktok">TikTok</option> <option value="nextdoor">Nextdoor</option> <!-- β¦ add as many as you like β¦ --> </select> <button id="addBtn">Add link</button> <div class="tags" id="tagWrap"></div> <!-- hidden field to persist the JSON --> <textarea id="json" name="social_links"></textarea> </div> <script> /*Β ββββββββββββββββββββ data ββββββββββββββββββββΒ */ const ICON = { twitter:`<svg viewBox="0 0 16 16" fill="currentColor"><path d="M16 3.038a6.54 6.54 0 0 1-1.885.516 3.301 3.301 0 0 0 1.443-1.817 6.533 6.533 0 0 1-2.07.793A3.286 3.286 0 0 0 7.88 4.485a9.325 9.325 0 0 1-6.767-3.43 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 5.575v.041 a3.288 3.288 0 0 0 2.633 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.615-.057 3.29 3.29 0 0 0 3.067 2.278 6.588 6.588 0 0 1-4.862 1.358A9.29 9.29 0 0 0 5.026 14 c6.038 0 9.341-5 9.341-9.334 0-.142-.003-.283-.01-.422A6.68 6.68 0 0 0 16 3.039"></path></svg>`, facebook:`<svg viewBox="0 0 16 16" fill="currentColor"><path d="M9.197 8.56v6.99H6.178V8.56H4.607V6.346h1.571V4.88 c0-1.304.738-3.324 3.324-3.324l2.438.01v2.714H10.77 c-.262 0-.63.131-.63.689v1.378h2.567l-.327 2.214H10.14z"/></svg>`, instagram:`<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 5.533a2.467 2.467 0 1 0 0 4.934 2.467 2.467 0 0 0 0-4.934Zm0 4.067A1.6 1.6 0 1 1 8 6.8a1.6 1.6 0 0 1 0 3.2Z"/><path d="M13.106 0H2.894A2.9 2.9 0 0 0 0 2.894v10.212A2.9 2.9 0 0 0 2.894 16h10.212A2.9 2.9 0 0 0 16 13.106V2.894A2.9 2.9 0 0 0 13.106 0ZM8 12.267A4.267 4.267 0 1 1 12.267 8 4.272 4.272 0 0 1 8 12.267Zm4.533-7.467a.933.933 0 1 1 .933-.933.934.934 0 0 1-.933.933Z"/></svg>`, linkedin:`<svg viewBox="0 0 16 16" fill="currentColor"><path d="M1.146 1.146C.513 1.78.513 2.72.513 4.54v6.92c0 1.82 0 2.76.633 3.394.633.633 1.573.633 3.393.633h6.92c1.82 0 2.76 0 3.393-.633.633-.634.633-1.574.633-3.394V4.54c0-1.82 0-2.76-.633-3.394C13.173.513 12.233.513 10.413.513H3.493c-1.82 0-2.76 0-3.347.633Zm4.684 4.763H3.987v6.672h1.843V5.909Zm-.92-3.01a1.065 1.065 0 1 0 0 2.131 1.065 1.065 0 0 0 0-2.131ZM12.13 7.926c0-2.129-1.496-3.1-3.487-3.1-1.604 0-2.323.88-2.724 1.5V5.909H4.074c.025.684 0 6.672 0 6.672h1.843V9.906c0-.145.01-.291.053-.402.146-.291.479-.593 1.039-.593.734 0 1.028.447 1.028 1.103v3.567h1.843V9.796c0-2.031-1.086-2.983-2.538-2.983-.734 0-1.27.402-1.477.807v.013h-.013a3.55 3.55 0 0 1 .013-.013V5.909H8.557c0 .667-.013 6.672-.013 6.672h1.843V9.796c0-.145.01-.291.053-.402.146-.291.479-.593 1.039-.593.734 0 1.028.447 1.028 1.103v3.567H12.13V7.926Z"/></svg>` }; /* fallback icon */ const defaultIco = `<svg viewBox="0 0 16 16" fill="currentColor"> <circle cx="8" cy="8" r="7"/></svg>`; /*Β ββββββββββββββββββββ logic ββββββββββββββββββββΒ */ const sel = document.getElementById('platform'); const wrap = document.getElementById('tagWrap'); const txt = document.getElementById('json'); const btn = document.getElementById('addBtn'); let data = {}; // {platform:{handle,url}} function render(){ wrap.innerHTML=''; Object.keys(data).forEach(k=>{ const tag=document.createElement('span'); tag.className='tag'; tag.innerHTML= (ICON[k]||defaultIco)+` ${k} <span class=x>×</span>`; tag.querySelector('.x').onclick=()=>{ delete data[k]; render(); }; wrap.appendChild(tag); }); txt.value = JSON.stringify(data); } btn.onclick=()=>{ const key = sel.value; if(!key) return; /* prompt for handle / URL */ const val = prompt(`Enter your ${key} handle or URL:`,''); if(!val) return; data[key]={value:val}; render(); sel.selectedIndex=0; }; render(); // initial (empty) render </script>
Save changes
Create folder
writable 0777
Create
Cancel