Skip to content

[f] ver171 - Support markdown for landing page#138

Merged
nlgthuan merged 2 commits intomainfrom
ver-171-text-on-landing-page-should-support-markdown
Nov 7, 2024
Merged

[f] ver171 - Support markdown for landing page#138
nlgthuan merged 2 commits intomainfrom
ver-171-text-on-landing-page-should-support-markdown

Conversation

@nlgthuan
Copy link
Collaborator

@nlgthuan nlgthuan commented Nov 7, 2024

Description

This Pull Request introduces several updates and enhancements to the Landing Page component, including the integration of markdown rendering and adjustments to existing components and styles. These changes aim to improve content flexibility and user experience on the Landing Page.

Summary of Changes

  1. Integration of react-markdown:

    • Added the react-markdown dependency to package.json to facilitate markdown rendering within the application.
  2. Landing Page Enhancements:

    • Updated the Landing.tsx component to utilize react-markdown for the hero_title, hero_description, and footer_text. This allows for dynamic and rich text formatting using markdown syntax.
    • Renamed the default export from Component to LandingPage for clarity and consistency.
  3. Styling Adjustments:

    • Created a new Landing.scss file to encapsulate styles specific to the Landing Page, including hover effects on markdown links.
    • Applied a unique ID landing-page to the main container in Landing.tsx to scope styles appropriately.

Summary by CodeRabbit

  • New Features
    • Integrated Markdown rendering in the Landing Page for enhanced content display.
  • Styling Enhancements
    • Added hover effect for links in the markdown section on the Landing Page.
    • Improved spacing for paragraphs in the markdown section.
  • Refactor
    • Renamed component for clarity from Component to LandingPage.

@linear
Copy link

linear bot commented Nov 7, 2024

@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces a new dependency, react-markdown, to the package.json file. It also modifies the Landing.scss file by adding a CSS rule for hover effects on links within the markdown section of the landing page. In Landing.tsx, the component is renamed to LandingPage, and the Markdown component is integrated to render specific text content, allowing for Markdown formatting. The overall structure and logic of the component remain unchanged.

Changes

File Change Summary
package.json Added new dependency: "react-markdown": "^9.0.1" in dependencies.
src/pages/Landing.scss Added CSS rule for #landing-page .markdown a:hover { text-decoration: underline; }.
Added CSS rule for #landing-page .markdown p { margin: 8px 0; }.
src/pages/Landing.tsx Renamed component from Component to LandingPage, added import for Markdown, integrated it to render content.

Possibly related PRs

  • [f] Ver 149 - Landing page #109: The changes in Landing.tsx include the addition of the Markdown component from react-markdown, which directly relates to the new dependency added in the main PR's package.json.

Poem

In a landing page so bright,
Links now dance with delight.
Markdown's magic, we embrace,
With underlines, they find their place.
A rabbit hops, with joy to say,
"New dependencies make our day!" 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nlgthuan nlgthuan linked an issue Nov 7, 2024 that may be closed by this pull request
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fba4796 and 23357a8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json (1 hunks)
  • src/pages/Landing.scss (1 hunks)
  • src/pages/Landing.tsx (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/pages/Landing.scss
🔇 Additional comments (5)
src/pages/Landing.tsx (4)

4-4: LGTM! Component rename improves clarity.

The component rename from Component to LandingPage better reflects its purpose and follows React naming conventions. The import organization is clean and logical.

Also applies to: 14-14, 16-16


61-63: Same security considerations as hero title section apply here.


83-85: Verify markdown link styles in footer.

Since footer text often contains links, ensure that the markdown styling (particularly link hover effects mentioned in the PR summary) works correctly in the light text on dark background scenario of the footer.

#!/bin/bash
# Check for markdown link styling rules
rg -l "\.markdown\s+a\s*(:hover)?\s*{" --type css --type scss

48-48: Verify uniqueness of landing-page ID.

The addition of the ID for scoped styling is good practice, but we should ensure it's unique across the application to prevent styling conflicts.

✅ Verification successful

The previous command failed because of file type restrictions. Let's try a broader search to find any occurrences of this ID across the codebase, including potential variations in naming conventions.


Let's try with the --pcre2 flag and simpler patterns to search for the ID and its variations.


ID 'landing-page' is unique across the codebase

The search results confirm that the 'landing-page' ID is only used once in src/pages/Landing.tsx, and no variations of this ID exist elsewhere in the codebase. This ensures there won't be any styling conflicts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of landing-page ID
rg -l "id=('|\")landing-page('|\")" --type html --type tsx --type jsx

Length of output: 103


Script:

#!/bin/bash
# Search for landing-page ID using ripgrep without file type restrictions
rg "id=(['\"])landing-page\1"

# Also search for potential variations in kebab/camel case
rg "id=(['\"])(landing[_-]?page|landingPage|LandingPage)\1"

Length of output: 581


Script:

#!/bin/bash
# Search for landing-page ID using simpler patterns
rg --pcre2 "id=['\"]landing-page['\"]"

# Search for potential variations without backreferences
rg --pcre2 "id=['\"]landing[-_]?page['\"]"
rg --pcre2 "id=['\"]landingPage['\"]"
rg --pcre2 "id=['\"]LandingPage['\"]"

Length of output: 385

package.json (1)

66-66: LGTM! Version choice is appropriate.

The addition of react-markdown@^9.0.1 is compatible with the project's React version (18.2.0) and follows semantic versioning best practices. The caret (^) allows for safe minor version updates while maintaining compatibility.

Let's verify there are no conflicting markdown packages:

✅ Verification successful

No conflicting markdown packages found

The verification confirms that react-markdown is the only markdown-related package in the dependencies. The other match cmdk is unrelated (it's a command palette package). The version choice and dependency addition are safe to proceed with.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any other markdown-related packages that might conflict
rg -i "markdown|md" package.json

Length of output: 88

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.

Text on landing page should support markdown

1 participant