Skip to content
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

Closes #514 #555

Merged
merged 4 commits into from
Feb 26, 2024
Merged

Closes #514 #555

merged 4 commits into from
Feb 26, 2024

Conversation

Akshithpottigari
Copy link
Contributor

@Akshithpottigari Akshithpottigari commented Feb 26, 2024

Using CSS variables for font family and the font size was easy to handle globally, and they were already present in the root, so no need to declare new variables and handle them differently, and also became handy for us to handle them throughout the app. We can add more fonts and more font sizes simply by loading them in the fonts.ts and font sizes array and we are good to go.

I have implemented #410 too, for detecting the connection status too.

We can close #514 and #410

Thanks in advance : )

@Akshithpottigari Akshithpottigari marked this pull request as ready for review February 26, 2024 08:14
Copy link
Contributor

@curran curran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thank you so much!

In future it would be best to address different issues in different PRs, but these changes are all good.

Some things to consider for future iterations on these features:

  • Ideally if a user selects a font and size, that should persist using localStorage, so that it's there when they refresh the page
  • The connection status is good, but does not handle the case of switching from "Saving..." to "Saved", which is something I'd really like to see in a future iteration

Thanks again!

const handleFontChange = (event) => {
let { body } = document;
body.style.setProperty(
'--vzcode-font-family',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@curran curran merged commit c39c463 into vizhub-core:main Feb 26, 2024
onChange={handleFontChange}
>
{fonts.map((font) => (
<option key={font} value={font}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not show the previously selected option when you close the modal then re-open it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@curran I thought issue #514 was just for implementing it. If you want me to maintain it in context level, and localStorage for saving it, I can do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it is correct! Now that the first version is ready, the next steps become clear.

I created a new issue to track the persistence: #562

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh but this comment was related to just the modal closing and re-opening, within a single session. I solved it in https://github.com/vizhub-core/vzcode/pull/559/files#diff-3cc8b6f15ff7e81275b96ef7bc6d64e13b89785525e651ccc6800b5da75aefa9R156

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable Font
2 participants