agentleFS
gravitee-iogravitee-io/gravitee-api-management/.cursor/rules/graphene-snippets/creation-wizard-page.tsx

gravitee-api-management / graphene-snippets

Cursor rule469 starsChanged 5 months agoApache-2.0View on GitHub

// Snippet: Creation wizard / stepper page with PageFocused // // Use when building a multi-step creation flow, onboarding sequence, // or any focused linear task (Create API, Create Agent, Import, etc.). // // Content width: Wrap in <PageFocused> to constrain and center within the // container. The centering signals to the user that they are in a focused sub-task. // // Do NOT use for: // - Regular settings/form pages (they use the default container as-is) // - DataTable…

The file

Files
creation-wizard-page.tsx
// Snippet: Creation wizard / stepper page with PageFocused
//
// Use when building a multi-step creation flow, onboarding sequence,
// or any focused linear task (Create API, Create Agent, Import, etc.).
//
// Content width: Wrap in <PageFocused> to constrain and center within the
// container. The centering signals to the user that they are in a focused sub-task.
//
// Do NOT use for:
// - Regular settings/form pages (they use the default container as-is)
// - DataTable list pages (they fill the container naturally)
// - Wide two-column wizards (use the default container instead)
//
// Decision rule: If the user navigated INTO a single-column creation/wizard flow → <PageFocused>.

import { useState } from 'react';
import { Button, Card, CardContent, Field, Input, Label, PageFocused, Separator } from '@gravitee/graphene-core';
import { ArrowLeftIcon, ArrowRightIcon, RocketIcon } from '@gravitee/graphene-core/icons';

// Replace with your actual step definitions
const STEPS = ['Details', 'Configure', 'Review'] as const;

export function CreateResourceWizardPage() {
  const [step, setStep] = useState(0);
  const isLastStep = step === STEPS.length - 1;

  function handleNext() {
    if (isLastStep) {
      // Replace with your create mutation
      return;
    }
    setStep((s) => s + 1);
  }

  function handleBack() {
    if (step === 0) {
      // Replace with your navigation back
      return;
    }
    setStep((s) => s - 1);
  }

  return (
    <PageFocused>
      <div className="space-y-6">
        {/* Step indicator */}
        <nav aria-label="Progress" className="flex items-center justify-center gap-2">
          {STEPS.map((label, i) => (
            <div key={label} className="flex items-center gap-2">
              <div className="flex items-center gap-1.5">
                <div
                  className={`flex size-6 items-center justify-center rounded-full text-xs font-medium ${
                    i <= step ? 'bg-primary text-primary-foreground' : 'border border-border text-muted-foreground'
                  }`}
                >
                  {i + 1}
                </div>
                <span className={`text-sm ${i <= step ? 'font-medium' : 'text-muted-foreground'}`}>{label}</span>
              </div>
              {i < STEPS.length - 1 && <div className="h-px w-8 bg-border" />}
            </div>
          ))}
        </nav>

        {/* Step content */}
        <Card>
          <CardContent className="space-y-4 pt-6">
            {step === 0 && (
              <>
                <Field>
                  <Label>Resource name</Label>
                  <Input placeholder="Enter a name" />
                </Field>
                <Field>
                  <Label>Description</Label>
                  <Input placeholder="Optional description" />
                </Field>
              </>
            )}
            {step === 1 && (
              <Field>
                <Label>Configuration</Label>
                <Input placeholder="Enter configuration value" />
              </Field>
            )}
            {step === 2 && (
              <div className="space-y-2">
                <p className="text-sm font-medium">Review your configuration</p>
                <p className="text-sm text-muted-foreground">Confirm the details below before creating.</p>
              </div>
            )}
          </CardContent>
        </Card>

        <Separator />

        {/* Navigation buttons */}
        <div className="flex items-center justify-between">
          <Button variant="outline" onClick={handleBack}>
            <ArrowLeftIcon className="size-4" aria-hidden />
            {step === 0 ? 'Cancel' : 'Back'}
          </Button>
          <Button onClick={handleNext}>
            {isLastStep ? (
              <>
                <RocketIcon className="size-4" aria-hidden />
                Create
              </>
            ) : (
              <>
                Next
                <ArrowRightIcon className="size-4" aria-hidden />
              </>
            )}
          </Button>
        </div>
      </div>
    </PageFocused>
  );
}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.