Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions examples/example32-schematic-search.fixture.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import type { SubcircuitProps } from "@tscircuit/props"
import { SchematicViewer } from "lib/components/SchematicViewer"
import { renderToCircuitJson } from "lib/dev/render-to-circuit-json"

const SensorSheet = (props: SubcircuitProps) => (
<subcircuit {...props}>
<chip
name="U_SENSOR"
footprint="soic4"
manufacturerPartNumber="SHT40"
pinLabels={{ pin1: "VCC", pin2: "SDA", pin3: "SCL", pin4: "GND" }}
connections={{
VCC: "net.VCC",
SDA: "net.I2C_SDA",
SCL: "net.I2C_SCL",
GND: "net.GND",
}}
/>
<capacitor
name="C_SENSOR"
capacitance="100nF"
footprint="0402"
connections={{ pin1: "net.VCC", pin2: "net.GND" }}
/>
</subcircuit>
)

const PowerSheet = (props: SubcircuitProps) => (
<subcircuit {...props}>
<chip
name="U_REG"
footprint="sot23"
manufacturerPartNumber="AP2112K"
pinLabels={{ pin1: "VIN", pin2: "GND", pin3: "VOUT" }}
connections={{
VIN: "net.VBUS",
GND: "net.GND",
VOUT: "net.VCC",
}}
/>
<capacitor
name="C_OUT"
capacitance="1uF"
footprint="0402"
connections={{ pin1: "net.VCC", pin2: "net.GND" }}
/>
</subcircuit>
)

const circuitJson = renderToCircuitJson(
<board routingDisabled>
<schematicsheet name="Sensors" displayName="Sensors" sheetIndex={0} />
<schematicsheet name="Power" displayName="Power" sheetIndex={1} />
<SensorSheet name="SENSORS" schSheetName="Sensors" />
<PowerSheet name="POWER" schSheetName="Power" />
</board>,
)

export default () => (
<SchematicViewer
circuitJson={circuitJson}
containerStyle={{ width: "100vw", height: "100vh" }}
/>
)
32 changes: 32 additions & 0 deletions examples/example33-single-sheet-schematic-search.fixture.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { SchematicViewer } from "lib/components/SchematicViewer"
import { renderToCircuitJson } from "lib/dev/render-to-circuit-json"

const circuitJson = renderToCircuitJson(
<board routingDisabled>
<chip
name="U_SENSOR"
footprint="soic4"
manufacturerPartNumber="SHT40"
pinLabels={{ pin1: "VCC", pin2: "SDA", pin3: "SCL", pin4: "GND" }}
connections={{
VCC: "net.VCC",
SDA: "net.I2C_SDA",
SCL: "net.I2C_SCL",
GND: "net.GND",
}}
/>
<capacitor
name="C_SENSOR"
capacitance="100nF"
footprint="0402"
connections={{ pin1: "net.VCC", pin2: "net.GND" }}
/>
</board>,
)

export default () => (
<SchematicViewer
circuitJson={circuitJson}
containerStyle={{ width: "100vw", height: "100vh" }}
/>
)
Loading
Loading