Skip to content

Commit

Permalink
prop structure for getting nodeType in node form
Browse files Browse the repository at this point in the history
  • Loading branch information
buckhalt committed Sep 24, 2024
1 parent 922eb20 commit 79e3f81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/interview/icons/LucideAddNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { LucideProps } from 'lucide-react';
import dynamicIconImports from 'lucide-react/dynamicIconImports';
import { Circle } from 'lucide-react';

// do we need a fallback for this?
const fallback = <Circle size={60} />;

type IconProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { cn } from '~/lib/utils';
import { interfaceWrapperClasses } from '../../ui/SimpleShell';
import { withOnboardingWizard } from '~/components/onboard-wizard/withOnboardingWizard';
import { type InterviewStage } from '../../ui/InterviewShell';
import { TNodeType } from '~/schemas/protocol/codebook/entities';

const demoPrompts = [
{
Expand Down Expand Up @@ -75,6 +76,11 @@ const demoNodes = [
},
];

const demoNodeType = {
color: 'seq-node-1',
icon: 'school',
} as TNodeType;

function NameGenerator(_props: InterviewStage) {
return (
<div className={cn(interfaceWrapperClasses, 'flex grow flex-col gap-4')}>
Expand All @@ -85,7 +91,7 @@ function NameGenerator(_props: InterviewStage) {
<NodeList items={demoNodes} />
</div>
</div>
<QuickNodeForm />
<QuickNodeForm nodeType={demoNodeType} />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import { useState } from 'react';
import ActionButton from '~/components/interview/ActionButton';
import Node from '~/components/Node';
import type { TNodeType } from '~/schemas/protocol/codebook/entities';

export default function QuickNodeForm() {
export default function QuickNodeForm({ nodeType }: { nodeType: TNodeType }) {
const [showForm, setShowForm] = useState(false);

return (
Expand All @@ -27,7 +28,10 @@ export default function QuickNodeForm() {
)}
{!showForm && (
<div className="mr-8" id="data-wizard-task-step-3">
<ActionButton onClick={() => setShowForm(true)} icon="backpack" />
<ActionButton
onClick={() => setShowForm(true)}
icon={nodeType.icon}
/>
</div>
)}
</div>
Expand Down

0 comments on commit 79e3f81

Please sign in to comment.