Skip to content

Improve live code visuals #3654

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

Merged
merged 6 commits into from
Mar 27, 2025
Merged

Improve live code visuals #3654

merged 6 commits into from
Mar 27, 2025

Conversation

ethanshar
Copy link
Collaborator

@ethanshar ethanshar commented Mar 26, 2025

Description

Improve live code visuals

  • Move to css styling
  • Add theme to the live code
  • Fix preview container flex to behave like it does in mobile
  • Increase page max width

Unrelated, fix minor issue in TableSection to avoid error when missing cell (item) data - this will show empty cell instead of throwing a vague error

Changelog

N/A

Additional info

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the live code visuals by transitioning styling to CSS modules, adding a Prism theme for the live editor, and fixing flex behavior on mobile for the preview container, while also addressing a bug in TableSection when cell data is missing.

  • Introduces conditional rendering and safe property access in TableSection to avoid errors.
  • Migrates UILivePreview styling from react-native to CSS modules and integrates a new code formatting hook.
  • Updates livePreview.tsx to employ CSS modules for improved mobile flex layout.

Reviewed Changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.

File Description
TableSection.tsx Adds a null-check for cell data to prevent runtime errors
UILivePreview.tsx Migrates styling to CSS modules and applies a Prism theme
useFormattedCode.ts Updates the initial state for code formatting so it starts as an empty string
livePreview.tsx Adopts CSS modules for the mobile preview container layout
Files not reviewed (3)
  • docuilib/package.json: Language not supported
  • docuilib/src/components/UILivePreview.module.scss: Language not supported
  • docuilib/src/pages/livePreview.module.css: Language not supported
Comments suppressed due to low confidence (1)

docuilib/src/hooks/useFormattedCode.ts:9

  • [nitpick] Using an empty string as the initial value might result in a less informative UI while formatting is in progress; consider providing a placeholder or loading indicator if formatting takes noticeable time.
const [formattedCode, setFormattedCode] = useState<string>('');

Copy link
Collaborator

@M-i-k-e-l M-i-k-e-l left a comment

Choose a reason for hiding this comment

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

I feel like there's not enough contrast between the "device" and the screen

display: flex;
flex-direction: column;
flex: 1;
padding: 20px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we want the "user" to decide on the padding? Could we have a screen that wants no padding?

@M-i-k-e-l M-i-k-e-l assigned ethanshar and unassigned M-i-k-e-l Mar 27, 2025
@ethanshar ethanshar enabled auto-merge (squash) March 27, 2025 09:02
@ethanshar ethanshar merged commit 2a56a07 into master Mar 27, 2025
1 check passed
@ethanshar ethanshar deleted the docs/improve_live_code branch March 27, 2025 09:03
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.

2 participants