diff options
author | 2022-07-07 05:19:30 +0000 | |
---|---|---|
committer | 2022-07-07 05:19:30 +0000 | |
commit | c78c810294b90d5683e864f2a6411e486147886b (patch) | |
tree | b6f9beb3875a571e15c658583e8d4ed20027d48a | |
parent | c8d51cc05a26f2e4df8a0bf35d069daf97f075ce (diff) | |
download | bun-c78c810294b90d5683e864f2a6411e486147886b.tar.gz bun-c78c810294b90d5683e864f2a6411e486147886b.tar.zst bun-c78c810294b90d5683e864f2a6411e486147886b.zip |
Refactor InstallBox
-rw-r--r-- | packages/bun-landing/index.css | 56 | ||||
-rw-r--r-- | packages/bun-landing/page.tsx | 25 |
2 files changed, 36 insertions, 45 deletions
diff --git a/packages/bun-landing/index.css b/packages/bun-landing/index.css index 4a86f480b..caea8ec9f 100644 --- a/packages/bun-landing/index.css +++ b/packages/bun-landing/index.css @@ -154,27 +154,24 @@ header { background: #15140e; padding: 24px 24px; border-radius: 24px; + user-select: none; + -webkit-user-select: none; + -webkit-user-drag: none; + -moz-user-select: none; } -#install-label-heading { +.InstallBox-label-heading { font-size: 1.4rem; margin-bottom: 1rem; font-weight: 500; font-weight: 500; } -#install-label-subtitle { +.InstallBox-label-subtitle { font-size: 0.9rem; color: var(--orange-light); } -.unselectable { - user-select: none; - -webkit-user-select: none; - -webkit-user-drag: none; - -moz-user-select: none; -} - #usecases-section { background: linear-gradient(12deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2)), conic-gradient( @@ -218,7 +215,7 @@ header { padding: 0; } -#code-box { +.InstallBox-code-box { background-color: rgb(37, 36, 32); padding: 4px 16px; position: relative; @@ -235,12 +232,18 @@ header { font-family: var(--monospace-font); } -#curl:hover { - cursor: text; +.InstallBox-curl { + user-select: all; + -webkit-user-select: text; pointer-events: auto; + white-space: nowrap; + cursor: text; + display: inline-flex; + padding: 12px 8px; + gap: 2ch; } -#curl::before { +.InstallBox-curl::before { display: block; content: "$" / ""; color: var(--orange); @@ -249,22 +252,11 @@ header { height: 1ch; } -#curl { - user-select: all; - -webkit-user-select: text; - pointer-events: auto; - white-space: nowrap; - cursor: text; - display: inline-flex; - padding: 12px 8px; - gap: 2ch; -} - -#view-source-link { +.InstallBox-view-source-link { color: var(--orange-light); } -#code-box-copy { +.InstallBox-copy { height: 100%; display: flex; @@ -281,12 +273,12 @@ header { font-family: inherit; } -#code-box-copy:hover { +.InstallBox-copy:hover { color: var(--blue); transform: scale(1.06); } -#code-box-copy:active { +.InstallBox-copy:active { transform: scale(1.12); } @@ -692,7 +684,7 @@ li { gap: 1rem; } - #install { + .InstallBox { margin-top: 0; } @@ -711,11 +703,11 @@ li { } @media (max-width: 599px) { - #code-box-copy { + .InstallBox-copy { display: none; } - #code-box { + .InstallBox-code-box { font-size: 0.8rem; } } @@ -792,7 +784,7 @@ li { } @media (max-width: 929px) { - #code-box { + .InstallBox-code-box { width: fit-content; } diff --git a/packages/bun-landing/page.tsx b/packages/bun-landing/page.tsx index 6de5dd71b..21f8aeb52 100644 --- a/packages/bun-landing/page.tsx +++ b/packages/bun-landing/page.tsx @@ -177,25 +177,23 @@ const InstallBox = ({ desktop = false }) => ( className={ "InstallBox " + (desktop ? "InstallBox--desktop" : "InstallBox--mobile") } - id="install" > - <div id="install-label"> - <div className="unselectable" id="install-label-heading"> + <div className="InstallBox-label"> + <div className="InstallBox-label-heading"> Install Bun CLI v0.1.0 (beta) </div> - <div className="unselectable" id="install-label-subtitle"> + <div className="InstallBox-label-subtitle"> macOS x64 & Silicon, Linux x64, Windows Subsystem for Linux </div> </div> - <div id="code-box"> - <div id="curl">curl https://bun.sh/install | bash</div> - <button className="unselectable" id="code-box-copy" aria-label="Copy installation script"> + <div className="InstallBox-code-box"> + <div className="InstallBox-curl">curl https://bun.sh/install | bash</div> + <button className="InstallBox-copy" aria-label="Copy installation script"> copy </button> </div> <a - className="unselectable" - id="view-source-link" + className="InstallBox-view-source-link" target="_blank" href="https://bun.sh/install" > @@ -793,10 +791,11 @@ export default { }); }); -document.querySelector("#code-box-copy").addEventListener("click", async e => { - var el = document.querySelector("#code-box"); - await navigator.clipboard.writeText("curl https://bun.sh/install | bash"); -}); +for (const el of document.querySelectorAll(".InstallBox-copy")) { + el.addEventListener("click", async e => { + await navigator.clipboard.writeText("curl https://bun.sh/install | bash"); + }); +} `, }} /> |