Home / File/ AddToCartForm.tsx — astro Source File

AddToCartForm.tsx — astro Source File

Architecture documentation for AddToCartForm.tsx, a tsx file in the astro codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  9bd09477_d318_1e25_4e51_a3d91bcf1ef7["AddToCartForm.tsx"]
  edd8f249_c500_21a1_e709_e13be23ae578["cartStore.ts"]
  9bd09477_d318_1e25_4e51_a3d91bcf1ef7 --> edd8f249_c500_21a1_e709_e13be23ae578
  c22706ec_775e_3904_0a66_f2ff24edc7ab["addCartItem"]
  9bd09477_d318_1e25_4e51_a3d91bcf1ef7 --> c22706ec_775e_3904_0a66_f2ff24edc7ab
  0fef379e_25c0_6f95_11fd_6d0f7db42b7e["preact"]
  9bd09477_d318_1e25_4e51_a3d91bcf1ef7 --> 0fef379e_25c0_6f95_11fd_6d0f7db42b7e
  style 9bd09477_d318_1e25_4e51_a3d91bcf1ef7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ComponentChildren } from 'preact';
import type { CartItemDisplayInfo } from '../cartStore';
import { addCartItem, isCartOpen } from '../cartStore';

type Props = {
	item: CartItemDisplayInfo;
	children: ComponentChildren;
};

export default function AddToCartForm({ item, children }: Props) {
	function addToCart(e: SubmitEvent) {
		e.preventDefault();
		isCartOpen.set(true);
		addCartItem(item);
	}

	return <form onSubmit={addToCart}>{children}</form>;
}

Domain

Functions

Types

Dependencies

Frequently Asked Questions

What does AddToCartForm.tsx do?
AddToCartForm.tsx is a source file in the astro codebase, written in tsx. It belongs to the StateStores domain, NanostoresImplementation subdomain.
What functions are defined in AddToCartForm.tsx?
AddToCartForm.tsx defines 1 function(s): AddToCartForm.
What does AddToCartForm.tsx depend on?
AddToCartForm.tsx imports 3 module(s): addCartItem, cartStore.ts, preact.
Where is AddToCartForm.tsx in the architecture?
AddToCartForm.tsx is located at examples/with-nanostores/src/components/AddToCartForm.tsx (domain: StateStores, subdomain: NanostoresImplementation, directory: examples/with-nanostores/src/components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free