Git Product home page Git Product logo

Comments (1)

dosubot avatar dosubot commented on June 30, 2024 3

Hey @msyavuz! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. I'm a bot designed to assist you while we wait for a human maintainer.

To fix the custom Storybook controls for the Alert, AsyncAceEditor, Badge, and Button components in the Apache Superset project, you need to ensure that the args and argTypes properties are correctly defined to provide the necessary controls in the Storybook UI. Here are the configurations for each component:

Alert Component

export const InteractiveAlert = (args: AlertProps) => (
  <>
    <Alert {...args} />
    Some content to test the `roomBelow` prop
  </>
);

InteractiveAlert.args = {
  closable: true,
  roomBelow: false,
  type: 'info',
  message: smallText,
  description: bigText,
  showIcon: true,
};

InteractiveAlert.argTypes = {
  onClose: { action: 'onClose' },
  type: {
    control: { type: 'select', options: ['info', 'error', 'warning', 'success'] },
  },
};

AsyncAceEditor Component

export const AsyncAceEditor = (
  args: AsyncAceEditorOptions & { editorType: EditorType },
) => {
  const { editorType, ...props } = args;
  const Editor = parseEditorType(editorType);
  return <Editor {...props} />;
};

AsyncAceEditor.args = {
  defaultTabSize: 2,
  width: '100%',
  height: '500px',
  value: `{"text": "Simple text"}`,
};

AsyncAceEditor.argTypes = {
  editorType: {
    defaultValue: 'json',
    control: { type: 'select', options: editorTypes },
  },
  defaultTheme: {
    defaultValue: 'github',
    control: { type: 'radio', options: ['textmate', 'github'] },
  },
};

Badge Component

export const InteractiveBadge = (args: BadgeProps) => <Badge {...args} />;

InteractiveBadge.args = {
  count: null,
  color: null,
  text: 'Text',
  textColor: null,
  status: 'success',
  size: 'default',
};

InteractiveBadge.argTypes = {
  status: {
    control: {
      type: 'select',
      options: [undefined, 'default', 'error', 'warning', 'success', 'processing'],
    },
  },
  size: {
    control: {
      type: 'select',
      options: ['default', 'small'],
    },
  },
  color: {
    control: {
      type: 'select',
      options: [undefined, 'pink', 'red', 'yellow', 'orange', 'cyan', 'green', 'blue', 'purple', 'geekblue', 'magenta', 'volcano', 'gold', 'lime'],
    },
  },
  textColor: {
    control: {
      type: 'select',
      options: [undefined, 'pink', 'red', 'yellow', 'orange', 'cyan', 'green', 'blue', 'purple', 'geekblue', 'magenta', 'volcano', 'gold', 'lime'],
    },
  },
  count: {
    control: {
      type: 'select',
      options: [undefined, ...Array(100).keys()],
    },
  },
};

Button Component

Ensure that the args and argTypes are defined similarly to provide controls for the Button component properties.

This setup ensures that the properties are available as controls in the Storybook UI, allowing users to select different options for these properties. The args property provides default values for the component's props, ensuring that the component renders correctly with initial values [1][2][3].

To continue talking to Dosu, mention @dosu.

from superset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.