tldraw/packages
Gabriel Lee 260a31db81
feat: add new prop to force mobile mode layout (#1734)
Adds a new prop to force mobile mode layout, similar to how the
?layout=mobile query param works.

An alternative of having the prop accept a breakpoint number was
considered, but while that provides more flexibility, it's best if
usages of tldraw don't need to know about the internal workings of
tldraw. (e.g. someone might use breakpoint 7 to get the "desktop" mode,
but that won't be reliable when in the future more breakpoints are
added)


![licecap-output-1](https://github.com/tldraw/tldraw/assets/5616556/b08fa239-be4f-46c2-9a78-c53b453e4d1a)

![licecap-output-2](https://github.com/tldraw/tldraw/assets/5616556/9be55807-adc7-4253-8b20-757a07a8b157)

Closes #1709 

### Change Type

- [ ] `patch` — Bug fix
- [x] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. `<Tldraw persistenceKey="tldraw_example" autoFocus
forceMobileModeLayout />`
2. notice that the layout stays in mobile mode no matter the width of
the screen

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- add new prop to force mobile mode layout

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-11-11 14:11:59 +00:00
..
assets Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00
editor [fix] masked bounds calculation (#2197) 2023-11-11 13:50:48 +00:00
state Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00
store Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00
tldraw feat: add new prop to force mobile mode layout (#1734) 2023-11-11 14:11:59 +00:00
tlschema Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00
utils Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00
validate Update CHANGELOG.md [skip ci] 2023-11-10 10:49:37 +00:00