Skip to main content
100%

Fork of smiley face refactoring into react components

✓ Published1🌍 Public
Ddmr
Last edited Nov 13, 2021
Created on Nov 13, 2021

This example demonstrates a modular React approach to rendering a smiley face using SVG. The `Face` component composes `BackgroundCircle`, `Eyes`, and `Mouth` components, each receiving explicit props for positioning and sizing. The `FaceContainer` renders the SVG wrapper and a translated `<g>` group, while `Mouth` uses `d3.arc` to generate a path for a smile. Hardcoded offsets from earlier versions are replaced with configurable numeric props passed from a top-level `App` component, which renders the face into the DOM via `ReactDOM.render`.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

extra notes

Smiley face part 1 uses svg to create the face and two eyes but we need to be able to use some math to set items out without hard coding all the x and y offsets

so it's time for REACT

In this fork:

  • refactor the drawing elements like circle into React components with meaningful names
MIT Licensed

Similar vizzes