Skip to content

Commit

Permalink
Fix PropTable usage
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpetryk committed Feb 19, 2024
1 parent 5285d7a commit 2f12dfb
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 39 deletions.
2 changes: 1 addition & 1 deletion docs/app/guides/display/circles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function Page() {

<CodeAndExample component={<MovableCircle />} source={MovableCircleSource} />

<PropTable of={Circle} />
<PropTable of={"Circle"} />
</>
)
}
4 changes: 2 additions & 2 deletions docs/app/guides/display/coordinates/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function CoordinatesPage() {
source={CartesianCoordinatesExampleSource}
/>

<PropTable of={Coordinates.Cartesian} />
<PropTable of={"Coordinates.Cartesian"} />

<h3>Axis options</h3>

Expand Down Expand Up @@ -79,7 +79,7 @@ function CoordinatesPage() {
source={PolarCoordinatesExampleSource}
/>

<PropTable of={Coordinates.Polar} />
<PropTable of={"Coordinates.Polar"} />

<h3>Axis options</h3>

Expand Down
4 changes: 2 additions & 2 deletions docs/app/guides/display/debug/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function DebugPage() {

<CodeAndExample component={<PizzaSliceExample />} source={PizzaSliceExampleSource} />

<PropTable of={Debug.TransformWidget} />
<PropTable of={"Debug.TransformWidget"} />

<h2>Viewport info</h2>

Expand All @@ -46,7 +46,7 @@ export default function DebugPage() {

<CodeAndExample component={<Example />} source={PaneVisualizerExampleSource} />

<PropTable of={Debug.ViewportInfo} />
<PropTable of={"Debug.ViewportInfo"} />
</>
)
}
2 changes: 1 addition & 1 deletion docs/app/guides/display/ellipses/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function Page() {

<CodeAndExample component={<MovableEllipse />} source={MovableEllipseSource} />

<PropTable of={Ellipse} />
<PropTable of={"Ellipse"} />

<WIP>
<p>
Expand Down
8 changes: 4 additions & 4 deletions docs/app/guides/display/lines/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ function Lines() {
<h2>Line segment</h2>

<CodeAndExample component={<LineSegmentExample />} source={LineSegmentExampleSource} />
<PropTable of={Line.Segment} />
<PropTable of={"Line.Segment"} />

<h2>Line through two points</h2>

<CodeAndExample
component={<LineThroughPointsExample />}
source={LineThroughPointsExampleSource}
/>
<PropTable of={Line.ThroughPoints} />
<PropTable of={"Line.ThroughPoints"} />

<h2>Point and slope</h2>

<CodeAndExample component={<LinePointSlopeExample />} source={LinePointSlopeExampleSource} />
<PropTable of={Line.PointSlope} />
<PropTable of={"Line.PointSlope"} />

<h2>Point and angle</h2>

<CodeAndExample component={<LinePointAngleExample />} source={LinePointAngleExampleSource} />
<PropTable of={Line.PointAngle} />
<PropTable of={"Line.PointAngle"} />
</>
)
}
Expand Down
11 changes: 5 additions & 6 deletions docs/app/guides/display/mafs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Mafs } from "mafs"
import CodeAndExample from "components/CodeAndExample"
import { PropTable } from "components/PropTable"

Expand All @@ -15,10 +14,10 @@ import StretchViewboxExample from "guide-examples/display/viewbox/StretchViewbox
import StretchViewboxExampleSource from "!raw-loader!guide-examples/display/viewbox/StretchViewbox"
import Code from "components/Code"

import type { Metadata } from "next"

export const metadata: Metadata = {
title: "Mafs",
export async function generateMetadata() {
return {
title: "Mafs",
}
}

function MafsPage() {
Expand All @@ -30,7 +29,7 @@ function MafsPage() {
</p>

<CodeAndExample component={<PlainMafsExample />} source={PlainMafsExampleSource} />
<PropTable of={Mafs} />
<PropTable of="Mafs" />

<h2>Sizing</h2>

Expand Down
10 changes: 5 additions & 5 deletions docs/app/guides/display/plots/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function Functions() {
Functions of <em className="font-display">x</em> and <em className="font-display">y</em>
</h2>
<CodeAndExample component={<OfXAndY />} source={OfXAndYSource} />
<PropTable of={Plot.OfX} />
<PropTable of={Plot.OfY} />
<PropTable of={"Plot.OfX"} />
<PropTable of={"Plot.OfY"} />

<h2>
Inequalities of <em className="font-display">x</em> and <em className="font-display">y</em>
Expand All @@ -52,11 +52,11 @@ function Functions() {
</p>

<CodeAndExample component={<InequalitiesExample />} source={InequalitiesExampleSource} />
<PropTable of={Plot.Inequality} />
<PropTable of={"Plot.Inequality"} />

<h2>Parametric functions</h2>
<CodeAndExample component={<TwistyBoi />} source={TwistyBoiSource} />
<PropTable of={Plot.Parametric} />
<PropTable of={"Plot.Parametric"} />

<h2>Vector fields</h2>

Expand All @@ -68,7 +68,7 @@ function Functions() {
</p>

<CodeAndExample component={<VectorFieldExample />} source={VectorFieldExampleSource} />
<PropTable of={Plot.VectorField} />
<PropTable of={"Plot.VectorField"} />

<h2>Render quality</h2>

Expand Down
2 changes: 1 addition & 1 deletion docs/app/guides/display/points/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function Points() {

<CodeAndExample component={<SimplePoint />} source={SimplePointSource} />

<PropTable of={Point} />
<PropTable of={"Point"} />
</>
)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/app/guides/display/polygons/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ function Polygons() {

<CodeAndExample component={<PolygonExample />} source={PolygonExampleSource} />

<PropTable of={Polygon} />
<PropTable of={"Polygon"} />

<CodeAndExample component={<PolylineExample />} source={PolylineExampleSource} />

<PropTable of={Polyline} />
<PropTable of={"Polyline"} />
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/app/guides/display/text/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Text() {

<CodeAndExample component={<TextExample />} source={TextExampleSource} />

<PropTable of={T} />
<PropTable of={"T"} />
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/app/guides/display/transform/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Page() {
source={SimpleTransformExampleSource}
/>

<PropTable of={Transform} />
<PropTable of={"Transform"} />

<h2>Transformation types</h2>

Expand Down
2 changes: 1 addition & 1 deletion docs/app/guides/display/vectors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Vectors() {

<CodeAndExample component={<VectorExample />} source={VectorExampleSource} />

<PropTable of={Vector} />
<PropTable of={"Vector"} />
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/app/guides/experimental/latex/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function LatexPage() {
the SVG foreignObject element.
</Experimental>

<PropTable of={LaTeX} />
<PropTable of={"LaTeX"} />

<h2>Usage</h2>

Expand Down
2 changes: 1 addition & 1 deletion docs/app/guides/interaction/movable-points/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function Stopwatch() {

<CodeAndExample component={<DynamicMovablePoints />} source={DynamicMovablePointsSource} />

<PropTable of={MovablePoint} />
<PropTable of={"MovablePoint"} />
</>
)
}
Expand Down
11 changes: 8 additions & 3 deletions docs/components/PropTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"use client"

import * as React from "react"
import * as Mafs from "mafs"
import ReactMarkdown from "react-markdown"
import { get } from "lodash"

export interface Docgen {
filePath: string
Expand All @@ -22,11 +26,12 @@ export type DocgenPropType =
| { name: string }

interface PropTableProps {
of: { displayName: string } | unknown
of: string
}

export function PropTable({ of: component }: PropTableProps) {
const docgenInfo = (component as { __docgenInfo: Docgen })?.__docgenInfo
export function PropTable({ of: componentName }: PropTableProps) {
const component = get(Mafs, componentName)
const docgenInfo = (component as unknown as { __docgenInfo: Docgen })?.__docgenInfo

if (process.env.NODE_ENV === "development" && docgenInfo == null) {
return (
Expand Down
2 changes: 2 additions & 0 deletions docs/components/guide-examples/PlainMafsExample.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Text } from "mafs"

export default function Example() {
Expand Down
2 changes: 2 additions & 0 deletions docs/components/guide-examples/custom/pizza-march.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { range } from "lodash"
Expand Down
2 changes: 2 additions & 0 deletions docs/components/guide-examples/custom/pizza-slice.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Coordinates, Debug } from "mafs"
import * as React from "react"

Expand Down
2 changes: 2 additions & 0 deletions docs/components/guide-examples/custom/point-cloud.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import {
Coordinates,
Debug,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Coordinates, Debug } from "mafs"

export default function Example() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Coordinates, labelPi } from "mafs"

export default function CartesianCoordinatesExample() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Coordinates } from "mafs"

export default function Example() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Coordinates } from "mafs"

export default function Example() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Mafs, Coordinates, Circle, Text } from "mafs"

export default function ZoomExample() {
Expand Down
7 changes: 0 additions & 7 deletions fix-guides.rb

This file was deleted.

0 comments on commit 2f12dfb

Please sign in to comment.