Skip to content

Commit

Permalink
fix toast position, sticky preview, improve code editor header filena…
Browse files Browse the repository at this point in the history
…me select box color (#149)
  • Loading branch information
seveibar authored Oct 31, 2024
1 parent a8824f1 commit 811832e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import React from "@types/react/jsx-runtime"
import { Circuit, createUseComponent } from "@tscircuit/core"
import type { CommonLayoutProps } from "@tscircuit/props"
`

export const CodeEditor = ({
onCodeChange,
onDtsChange,
Expand Down Expand Up @@ -209,7 +208,7 @@ export const CodeEditor = ({
hoverTooltip((view, pos, side) => {
const { from, to, text } = view.state.doc.lineAt(pos)
const line = text.slice(from, to)
const match = line.match(/@tsci\/[\w.]+/)
const match = line.match(/@tsci\/[\w\-.]+/)
if (match) {
const importName = match[0]
const start = line.indexOf(importName)
Expand Down Expand Up @@ -266,7 +265,7 @@ export const CodeEditor = ({
for (let pos = from; pos < to; ) {
const line = view.state.doc.lineAt(pos)
const lineText = line.text
const matches = lineText.matchAll(/@tsci\/[\w.]+/g)
const matches = lineText.matchAll(/@tsci\/[\w\-.]+/g)
for (const match of matches) {
if (match.index !== undefined) {
const start = line.from + match.index
Expand Down
2 changes: 1 addition & 1 deletion src/components/CodeEditorHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const CodeEditorHeader = ({
<div className="flex items-center gap-2 px-2 border-b border-gray-200">
<div>
<Select value={currentFile} onValueChange={handleFileChange}>
<SelectTrigger className="h-7 px-3">
<SelectTrigger className="h-7 px-3 bg-white">
<SelectValue placeholder="Select file" />
</SelectTrigger>
<SelectContent>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PreviewContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const PreviewContent = ({
}, [circuitJson])

return (
<div className={cn("flex flex-col h-full relative", className)}>
<div className={cn("flex flex-col relative", className)}>
<div className="md:sticky md:top-2">
<Tabs
value={activeTab}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ToastViewport = React.forwardRef<
<ToastPrimitives.Viewport
ref={ref}
className={cn(
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:top-0 sm:right-0 sm:flex-col md:max-w-[420px]",
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:top-auto sm:right-0 sm:flex-col md:max-w-[420px]",
className,
)}
{...props}
Expand Down

0 comments on commit 811832e

Please sign in to comment.