Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prop type warning for typography #665

Open
YuAnWu0000 opened this issue Apr 9, 2024 · 0 comments
Open

Prop type warning for typography #665

YuAnWu0000 opened this issue Apr 9, 2024 · 0 comments

Comments

@YuAnWu0000
Copy link

I've added my custom colors : 'primary', 'scondary', 'success', 'error', 'info', 'warning' in the theme object.

const theme = {
  typography: {
    defaultProps: {
      variant: 'paragraph',
      color: 'primary',
      textGradient: false,
      className: ''
    },
    valid: {
      variants: [
        'h1',
        'h2',
        'h3',
        'h4',
        'h5',
        'h6',
        'lead',
        'paragraph',
        'small'
      ],
      colors: ['primary', 'scondary', 'success', 'error', 'info', 'warning']
    },
    styles: {
      variants: {
        h1: {
          display: 'block',
          fontSmoothing: 'antialiased',
          letterSpacing: 'tracking-normal',
          fontFamily: 'font-sans',
          fontSize: 'text-5xl',
          fontWeight: 'font-bold',
          lineHeight: 'leading-tight'
        }
      },
      colors: {
        primary: {
          color: 'text-primary'
        },
        secondary: {
          color: 'text-secondary'
        },
        success: {
          color: 'text-success'
        },
        error: {
          color: 'text-error'
        },
        info: {
          color: 'text-info'
        },
        warning: {
          color: 'text-warning'
        }
      }
    }
  }
}

And provided it as follows

const root = ReactDOM.createRoot(document.getElementById('root'))

root.render(
  // strict mode will render your component twice in dev env
  // <React.StrictMode>
  <ThemeProvider value={theme}>
    <App />
  </ThemeProvider>
  // </React.StrictMode>
)

It still came out with warnings like this...

擷取

What can I do to avoid the prop type warnings?
(btw, I am using the javascript, not typescript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant