tldraw/apps/dotcom/styles/core.css

236 lines
3.4 KiB
CSS
Raw Normal View History

styling: make dotcom and examples site have consistent font styling (#3271) Our font styling for dotcom vs. our examples app is _ever_ so slightly different. - the Inter fonts weren't being consistently linked. Sometimes we grabbed 700, sometimes 800, sometimes 500 or 400 - the dotcom specified a default weight of 500 and line-height 1.6 which was not specified in the our UI. this made the UI inconsistent - furthermore, we didn't specify `text-rendering` nor `font-smooth` and that also made things inconsistent - finally, our buttons needed to inherit the line-height because otherwise they were reverting to the user agent default before: <img width="1800" alt="Screenshot 2024-03-26 at 15 23 12" src="https://github.com/tldraw/tldraw/assets/469604/ee25c79c-5b43-4501-a126-255a9b03a4b8"> after: <img width="1800" alt="Screenshot 2024-03-26 at 15 22 53" src="https://github.com/tldraw/tldraw/assets/469604/a7a62441-e767-4919-b2bb-5c283eadd230"> ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Add a brief release note for your PR here. --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-03-27 09:44:22 +00:00
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap');
:root {
font-family:
Inter,
-apple-system,
'system-ui',
'Segoe UI',
'Noto Sans',
Helvetica,
Arial,
sans-serif,
'Apple Color Emoji',
'Segoe UI Emoji';
font-size: 12px;
font-weight: 500;
color: var(--text-color-0);
line-height: 1.6;
overscroll-behavior: none;
touch-action: none;
}
/*
1. Use a more-intuitive box-sizing model.
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
/*
2. Remove default margin
*/
* {
margin: 0;
}
/*
5. Improve media defaults
*/
img,
picture,
video,
canvas,
svg {
display: block;
max-width: 100%;
}
/*
6. Remove built-in form typography styles
*/
input,
button,
textarea,
select {
font: inherit;
}
/*
7. Avoid text overflows
*/
p,
h1,
h2,
h3,
h4,
h5,
h6 {
overflow-wrap: break-word;
}
html {
height: 100%;
}
html,
body {
overscroll-behavior-x: none;
}
body {
display: flex;
height: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-smooth: antialiased;
text-rendering: optimizeLegibility;
}
div {
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
.site-wrapper {
display: flex;
flex-direction: column;
flex-grow: 1;
height: 100%;
}
.icon {
flex-shrink: 0;
width: 20px;
height: 20px;
background-color: currentColor;
}
.scroll-light {
scrollbar-width: thin;
}
.scroll-light::-webkit-scrollbar {
display: block;
width: 8px;
height: 8px;
position: absolute;
top: 0;
left: 0;
background-color: inherit;
}
.scroll-light::-webkit-scrollbar-button {
display: none;
width: 0;
height: 10px;
}
.scroll-light::-webkit-scrollbar-thumb {
background-clip: padding-box;
width: 0;
min-height: 36px;
border: 2px solid transparent;
border-radius: 6px;
background-color: rgba(0, 0, 0, 0.25);
}
.scroll-light::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.3);
}
/* ------------------- Error Page ------------------- */
.error-page {
display: flex;
inset: 0px;
position: absolute;
align-items: center;
justify-content: center;
}
.error-page__container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 30px;
}
.error-page__content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}
/* text-header mb-sm */
.error-page__content h1 {
font-size: 20px;
font-weight: 800;
margin-bottom: 0.5rem;
}
/* text-primary-bold text-grey */
.error-page__content p {
font-size: 14px;
color: var(--text-color-2);
}
/* text-primary-bold text-grey */
.error-page__container a {
font-size: 14px;
font-weight: 500;
color: var(--text-color-2);
padding: 12px 4px;
Readonly / room creation omnibus (#3192) Reworks how the readonly urls work. Till now we just used a simple function that would scramble the slugs. Now we use a proper key value mapping between regular and readonly slugs: - We use two KV stores. One is for going from a slug to a readonly slug and the other one for going the other way around. They are populated at the same time. - We separate preview KV stores (dev, preview, staging) from production one. I've already created these on Cloudflare. [My understanding is ](https://developers.cloudflare.com/kv/reference/data-security/#encryption-at-rest)that ids [can be public](https://community.cloudflare.com/t/is-it-safe-to-keep-kv-ids-in-a-public-git-repo/517387/4) since we can only access KV from our worker. Happy to move them to env variables though. - [x] Disable creating new rooms when tldraw is embedded inside iframes on other websites (we check the referrer and if it's not the same as the iframe's origin we don't allow it) - [x] Fork a project when inside an iframe now opens the forked project on tldraw.com and not inside iframe. - [x] We allow embeding of iframes, but we now track the where they are used via the referrer. We send this to Vercel analytics. - [x] Improved UX of the share menu to make it less confusing. Toggle is gone. - [x] `/new` and `/r` routes not redirect to `/`. - [x] This introduces a new `/ro` route for readonly rooms. Legacy rooms still live on `/v`. - [x] Brought back `dotcom-shared` project to share code between BE and FE. Mostly types. - [x] Prevent creating of rooms by entering `/r/non-existing-slug`. - [x] Handle getting a readonly slug for old rooms. Added a comment about it [here](https://github.com/tldraw/tldraw/pull/3192/files#diff-c0954b3dc71bb7097c39656441175f3238ed60cf5cee64077c06e21da82182cbR17-R18). - [x] We no longer expose editor on the window object for readonly rooms. Prevents the users disabling readonly rooms manually. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [ ] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Make sure old readonly rooms still work. 2. Creating a readonly link from an existing room should still use `/v` path. 3. Newly created rooms should use `/ro` path for readonly rooms. Make sure these work as well. 4. `/r` room was disabled and redirects to `/` 5. `/new` should still work when not inside iframes. - [x] Unit Tests - [ ] End to end tests ### Release Notes 1. This adds new functionality for readonly rooms: - We have a new route `/ro` for newly created readonly rooms. These rooms no longer use the scrambling logic to create readonly slugs. Instead we now use KV storage from cloudflare to track the mapping for slugs -> readonly slug and readonly slug -> slug. - The old route `/v` is preserved, so that the old room still work as they did before. - For old rooms we will keep on generating the old readonly slugs, but for new rooms we'll start using the new logic. 2. We no longer prevent embedding of tldraw inside iframes. 3. We do prevent generating new rooms from inside the iframes though. `/r`, `/new`, `/r/non-existing-id` should not allow creation of new rooms inside iframes. Only `/new` still works when not inside iframes. 4. Forking a project from inside an iframe now opens it on tldraw.com 5. Slight copy change on the sharing menu. We no longer have a toggle between readonly and non-readonly links. 6. `editor` and `app` are no longer exposed on the window object for readonly rooms. Prevents users from using the `updateInstanceState` to escape readonly rooms. --------- Co-authored-by: Mime Čuvalo <mimecuvalo@gmail.com>
2024-04-25 14:10:40 +00:00
text-decoration: underline;
}
/* ------------------ Board history ----------------- */
.board-history__list {
padding: 8px 8px 8px 24px;
display: flex;
flex-direction: column;
gap: 8px;
}
.board-history__list a {
padding: 8px 8px 8px 0px;
}
.board-history__list a:hover {
text-decoration: underline;
}
.board-history__restore {
position: fixed;
top: 8px;
right: 8px;
}
/* ----------------- Iframe warning ----------------- */
.iframe-warning__container {
position: absolute;
inset: 0px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
}
.iframe-warning__link {
display: flex;
align-items: center;
gap: 4px;
padding: 32px;
font-size: 14px;
}
.iframe-warning__link svg {
width: 14px;
height: 14px;
}