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

feat: 簡易的なランディングページを追加 #10

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

tatsutakein
Copy link
Member

@tatsutakein tatsutakein commented Jun 21, 2024

Issue

概要

簡易的なランディングページを追加します。

レビュー観点

レビューレベル

  • Lv0: まったく見ないで Approve する
  • Lv1: ぱっとみて違和感がないかチェックして Approve する
  • Lv2: 仕様レベルまで理解して、仕様通りに動くかある程度検証して Approve する
  • Lv3: 実際に環境で動作確認したうえで Approve する

レビュー優先度

  • すぐに見てもらいたい ( hotfix など ) 🚀
  • 今日中に見てもらいたい 🚗
  • 今日〜明日中で見てもらいたい 🚶
  • 数日以内で見てもらいたい 🐢

参考リンク

スクリーンショット

Before After

Summary by CodeRabbit

  • New Features

    • Introduced a footer component with dynamic year display and responsive design.
    • Added a customizable hero section with title, tagline, and alignment options.
    • Introduced an icon component with customizable color, size, and gradient options.
    • Added metadata and theme handling in the main head component.
    • Created a navigation component with menu items, social media links, and a theme toggle.
    • Implemented a theme toggle component for switching between dark and light themes.
    • Introduced a new base layout for consistent page structure and styling.
    • Added a 404 error page layout with a hero section.
  • Style

    • Updated global CSS with variables for themes, typography, and utility classes for better styling and responsive design.

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Copy link

coderabbitai bot commented Jun 21, 2024

Walkthrough

The codebase introduces a series of new components and stylings to create a simple yet functional landing page. Additions include a footer displaying the current year, a customizable hero section, dynamic icons, and theme toggling. Several files are imported to streamline layout and styling with responsive design, contributing to the landing page's comprehensive structure and visual appeal.

Changes

Files Change Summary
src/components/Footer.astro Introduced footer component with current year, external links, and responsive design CSS.
src/components/Hero.astro Added customizable hero section with title, tagline, and alignment options, including responsive styling.
src/components/Icon.astro, IconPaths.ts Introduced dynamic icon rendering with customizable properties, dynamic gradient, and a collection of SVG icon paths.
src/components/MainHead.astro Set up metadata, titles, and styles for web pages, including dark mode preference handling.
src/components/Nav.astro, ThemeToggle.astro Introduced navigation and theme toggle components, featuring menu items, social icons, and responsive design.
src/layouts/BaseLayout.astro, 404.astro, index.astro Created base layout and structured 404 and index pages with new components.
src/styles/global.css Defined global CSS variables, themes, and utility classes for responsive design.
src/env.d.ts No actual changes made (artifact of file update).

Sequence Diagram(s)

Loading
sequenceDiagram
    participant User
    participant Browser
    participant LandingPage
    participant Footer
    participant Hero
    participant NavBar
    participant ThemeToggle

    User ->> Browser: Open Landing Page
    Browser ->> LandingPage: Load Components
    LandingPage ->> Footer: Display Footer
    LandingPage ->> Hero: Display Hero Section
    LandingPage ->> NavBar: Display Navigation Bar
    NavBar ->> ThemeToggle: Include Theme Toggle
    ThemeToggle --> NavBar: Return Toggle Button
    LandingPage ->> User: Rendered Landing Page with Components

Assessment against linked issues

Objective (Issue #9) Addressed Explanation
Create a simple landing page
Include hero section with title, tagline, & layout
Provide dynamic and responsive design
Add footer with current year and external links

Poem

In a meadow where code does play, 🐇
A footer to end the digital day,
Icons sparkle, toggling bright,
Hero stands, leading with light. 🌟
A landing page born, truly grand,
In this web, where dreams do stand. 🌐


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link
Contributor

@tatsutakeinjp-bot tatsutakeinjp-bot bot left a comment

Choose a reason for hiding this comment

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

Device URL
mobile https://9507e704.asis-quest.pages.dev

Not what you expected? Are your scores flaky? GitHub runners could be the cause.
Try running on Foo instead

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

Outside diff range and nitpick comments (1)
src/components/Nav.astro (1)

18-66: Review of navigation structure and accessibility features.

The navigation structure uses semantic HTML elements appropriately, enhancing accessibility. The use of aria-expanded and aria-pressed attributes in buttons improves the experience for screen reader users. However, consider adding more descriptive comments or documentation to explain the interaction patterns and design decisions, especially for the dynamic elements like the theme toggle and menu button.

Consider adding more detailed comments to explain the purpose and behavior of interactive elements to aid other developers.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7d80717 and 3f503c5.

Files ignored due to path filters (22)
  • public/assets/app-store-badge.svg is excluded by !**/*.svg
  • public/assets/backgrounds/bg-footer-dark-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-footer-dark-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-footer-light-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-footer-light-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-main-dark-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-main-dark-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-main-dark.svg is excluded by !**/*.svg
  • public/assets/backgrounds/bg-main-light-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-main-light-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-main-light.svg is excluded by !**/*.svg
  • public/assets/backgrounds/bg-subtle-1-dark-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-1-dark-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-1-light-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-1-light-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-2-dark-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-2-dark-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-2-light-1440w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/bg-subtle-2-light-800w.jpg is excluded by !**/*.jpg
  • public/assets/backgrounds/noise.png is excluded by !**/*.png
  • public/assets/google-play-badge.png is excluded by !**/*.png
  • public/assets/icon.svg is excluded by !**/*.svg
Files selected for processing (12)
  • src/components/Footer.astro (1 hunks)
  • src/components/Hero.astro (1 hunks)
  • src/components/Icon.astro (1 hunks)
  • src/components/IconPaths.ts (1 hunks)
  • src/components/MainHead.astro (1 hunks)
  • src/components/Nav.astro (1 hunks)
  • src/components/ThemeToggle.astro (1 hunks)
  • src/env.d.ts (1 hunks)
  • src/layouts/BaseLayout.astro (1 hunks)
  • src/pages/404.astro (1 hunks)
  • src/pages/index.astro (1 hunks)
  • src/styles/global.css (1 hunks)
Files skipped from review due to trivial changes (4)
  • src/components/Footer.astro
  • src/env.d.ts
  • src/layouts/BaseLayout.astro
  • src/pages/404.astro
Additional comments not posted (14)
src/components/Hero.astro (2)

2-8: Interface and Props Extraction Approved

The Props interface is well-defined with appropriate optional properties. The default value for align is set correctly, and props are extracted properly using destructuring.


11-54: HTML Structure and CSS Styling Approved

The dynamic class assignment and conditional rendering in the HTML are implemented effectively. CSS is responsive and utilizes custom properties efficiently. Media queries are appropriately used to adjust styles based on device width.
[APROVED]

src/components/Icon.astro (3)

2-12: Interface and Prop Extraction in Icon Component Approved

The interface for the Icon component is correctly defined, and the props are extracted with appropriate default values. Import statements are accurate and necessary for the component's functionality.


21-48: SVG Rendering Logic Approved

The SVG rendering logic is well-implemented with proper use of accessibility attributes and conditional styling for gradients. The dynamic assignment of stroke and fill based on the gradient prop is effectively done.


50-56: SVG CSS Styling Approved

The CSS for the SVG element is appropriately defined, using custom properties to allow for flexible sizing. The default sizing strategy is practical and aligns well with common usage scenarios for icons.

src/components/MainHead.astro (2)

2-12: Interface and Prop Extraction in MainHead Component Approved

The interface for the MainHead component is appropriately defined with optional properties. The props are extracted with sensible default values, ensuring robustness in different usage scenarios.


15-47: HTML Structure and Embedded Script in MainHead Component Approved

The meta tags are set up correctly to enhance SEO and ensure responsiveness. The embedded script for managing the theme preference is well-implemented, offering an efficient solution for theme toggling.

src/pages/index.astro (2)

2-34: Component Usage and HTML Structure in Index Page Approved

The import and usage of the BaseLayout and Hero components are correctly implemented. The HTML structure is semantic and includes responsive design considerations, effectively organizing content on the page.


37-87: CSS Styling in Index Page Approved

The CSS is well-crafted, providing necessary styles for layout management and responsiveness. The use of flex and grid displays is aptly chosen to meet the design requirements of the landing page. Media queries are efficiently utilized to enhance the responsive design.

src/components/ThemeToggle.astro (1)

2-2: Import statement for Icon component.

The import statement ensures that the Icon component is available for use within ThemeToggle, which is crucial for displaying the icons for theme toggling.

src/styles/global.css (2)

2-74: Review of global CSS variables.

The CSS defines a comprehensive set of variables that control various design aspects such as colors, gradients, and shadows. This is a good practice as it centralizes style definitions making the code easier to maintain and modify. However, ensure that the color values and other properties match the design specifications and are consistent across different themes.


76-115: Review of dark theme CSS variables.

The variables for the dark theme are well defined, ensuring that the application can switch themes seamlessly. It's important to test these styles across different devices and browsers to ensure compatibility and consistency. The use of hsla for colors with alpha transparency is a good choice for theme flexibility.

src/components/Nav.astro (1)

2-4: Import statements in Nav component.

The import statements for Icon, ThemeToggle, and IconPaths are necessary for the functionality of the navigation component. These imports bring in essential elements and types that are used within the component. Ensure that these components and types are correctly defined and accessible.

src/components/IconPaths.ts (1)

1-38: Review of iconPaths definition in IconPaths.ts.

The iconPaths object is well-structured and provides a centralized location for managing SVG paths, which is excellent for maintainability. The comments provide clear instructions on how to add more icons, which is helpful for future contributors. Ensure that the SVG paths are optimized for performance and that accessibility considerations, such as aria-labels for icons, are met if these icons are used in an interactive context.

Comment on lines +70 to +94
<script>
class ThemeToggle extends HTMLElement {
constructor() {
super();

const button = this.querySelector('button')!;

/** Set the theme to dark/light mode. */
const setTheme = (dark: boolean) => {
document.documentElement.classList[dark ? 'add' : 'remove']('theme-dark');
button.setAttribute('aria-pressed', String(dark));
};

// Toggle the theme when a user clicks the button.
button.addEventListener('click', () => setTheme(!this.isDark()));

// Initialize button state to reflect current theme.
setTheme(this.isDark());
}

isDark() {
return document.documentElement.classList.contains('theme-dark');
}
}
customElements.define('theme-toggle', ThemeToggle);
Copy link

Choose a reason for hiding this comment

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

Review of ThemeToggle class and script logic.

This script defines a class ThemeToggle that extends HTMLElement, making it a custom HTML element. The class handles theme toggling logic within the constructor by adding event listeners to the button element. The isDark method checks if the dark theme is currently applied, which is a good approach to determine the current theme state. However, the script uses a non-null assertion operator (!) which can lead to runtime errors if the element is not found. Consider adding error handling or checks before using the operator.

Additionally, the theme toggling logic directly manipulates DOM classes and attributes, which is typical for custom elements but ensure this doesn't conflict with any framework-level state management if used.

- const button = this.querySelector('button')!;
+ const button = this.querySelector('button');
+ if (!button) throw new Error('Button not found in ThemeToggle component');
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<script>
class ThemeToggle extends HTMLElement {
constructor() {
super();
const button = this.querySelector('button')!;
/** Set the theme to dark/light mode. */
const setTheme = (dark: boolean) => {
document.documentElement.classList[dark ? 'add' : 'remove']('theme-dark');
button.setAttribute('aria-pressed', String(dark));
};
// Toggle the theme when a user clicks the button.
button.addEventListener('click', () => setTheme(!this.isDark()));
// Initialize button state to reflect current theme.
setTheme(this.isDark());
}
isDark() {
return document.documentElement.classList.contains('theme-dark');
}
}
customElements.define('theme-toggle', ThemeToggle);
<script>
class ThemeToggle extends HTMLElement {
constructor() {
super();
const button = this.querySelector('button');
if (!button) throw new Error('Button not found in ThemeToggle component');
/** Set the theme to dark/light mode. */
const setTheme = (dark: boolean) => {
document.documentElement.classList[dark ? 'add' : 'remove']('theme-dark');
button.setAttribute('aria-pressed', String(dark));
};
// Toggle the theme when a user clicks the button.
button.addEventListener('click', () => setTheme(!this.isDark()));
// Initialize button state to reflect current theme.
setTheme(this.isDark());
}
isDark() {
return document.documentElement.classList.contains('theme-dark');
}
}
customElements.define('theme-toggle', ThemeToggle);
</script>

@tatsutakein tatsutakein merged commit f5cfd0a into main Jun 21, 2024
8 checks passed
@tatsutakein tatsutakein deleted the feature/GH-9 branch June 21, 2024 01:48
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.

[Feature]: 簡易的なランディングページの作成
1 participant