-
Notifications
You must be signed in to change notification settings - Fork 698
Feature: FitText #1342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: FitText #1342
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 412e5b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Ah, what the heck, I've requested the Copilot auto code reviewer as well... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 8 changed files in this pull request and generated no suggestions.
Files not reviewed (3)
- examples/one-page/index.html: Language not supported
- .changeset/fuzzy-tips-build.md: Evaluated as low risk
- examples/js/index.js: Evaluated as low risk
Comments skipped due to low confidence (2)
packages/spectacle/src/components/typography.test.tsx:99
- Ensure the jest.mock implementation correctly resets between tests to avoid potential test interference.
jest.mock('use-resize-observer', () => { return { width: 500, height: 100 }; });
packages/spectacle/src/components/typography.test.tsx:134
- Review the transform: scale(1) check in the test to ensure it accurately verifies the scaling behavior.
expect(scaledText).toHaveStyle({ transform: 'scale(1)' });
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I like the idea of it. See the delta between the two containers and then apply a CSS scale. I think this would visually work best with single line headers and such. Like the legacy FitText less great for large paragraphs.
|
@carbonrobot @carloskelly13 I ended up removing the |
|
@ryan-roemer Those kinds of interactions you are almost testing your mocks more than the code. I think it's fine to merge. |
|
@carbonrobot I did one last minor tweak to this after Carlos' approval. I'll plan on merging this in the next day or so unless you wanted me to wait on another review pass? |
|
@ryan-roemer Looks good to me. |
The Basics
Description
Implements
FitTextcomponent, modeled after the original Spectacle'sfitproperty on various components. Makes ye olde stretchy text to expand dynamically to the width of the slide.Fixes #1211
Type of Change
How Has This Been Tested?
FitTextcomponent.start:jswith normal,exportMode=trueandprintMode=truestart:ts.one-pageas I couldn't quite get the right local reference to the Spectacle ESM entry point. (Might be worth figuring this out and adding a comment inone-page/index.html.)The Other Stuff
Ok team, go gentle on me as it's been a while since I've done any frontend work. But I've really, really wanted to get this functionality into Spectacle since it was lost many refactors ago.
Also, I'd love to get to have a look here to
The AI angle
I used Jolt AI for three of the commits here, with the following prompts below. @carloskelly13, if you have a moment and desire, would love to get your eyes on this for the Jolt prompts I used generating stuff on your end, how I had to tweak things to get it to work after, and for special bonus points, the actual substance of this code change.
( cc/ @cianclarke too :) )
My thoughts: The initial code gen was good, however the TypeScript wrangling took me over half the time to get it to all work, which it didn't out of the gates. (This, of course, is likely in most part just a skill issue). The tests needed a lot of work to get them to pass. The docs generation was simple and good.
The starting feature request (af5c1cc)
Plan and implement a feature whereby Spectacle can have text that fits the entire width of the containing slide. The alternatives to implement this plan would be:
FitText: A new component loosely modeled on theTextcomponent. It has all the same options, it just autofits to the entire width.fit=trueproperty on componentsHeader,Text.The requirements are:
Linkinside of aTextcomponent) should similar work with the text fit feature.The optional concerns are:
Unit tests (8bc61a5)
Write unit tests for the new
FitTextcomponent that match the other component tests intypography.test.tsx. Make sure to test all of the following:FitTexttext stays at full width even when container and window are resized.Textprops (likecolor, etc.) correctly work in theFitTextcomponent.TextandHeadingthat would apply toFitTextDocs (0ea80da)
Update the docs (
api-reference.md) to include the newFitTextcomponent. Model documentation after the existingTextcomponent, which has all of the same underlying properties besides thescaleproperty added to theFitTextcomponent.Screenshots
Presentation
Export / Print Mode