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

Refactor tailwind code to be more consistent #32

Open
Comeza opened this issue May 16, 2024 · 0 comments · May be fixed by #37
Open

Refactor tailwind code to be more consistent #32

Comeza opened this issue May 16, 2024 · 0 comments · May be fixed by #37
Assignees
Labels
frontend About the Frontend (liberica)
Milestone

Comments

@Comeza
Copy link
Member

Comeza commented May 16, 2024

Currently we use many anti-patterns throughout the entire code base.

I recommend to use some idioms from those blog posts:

Such as:

  • Well-defined staes instead of bool-based states
  • Disallow className in custom components as props (using `Omit<Reac.ComponentProps<'button'>, 'className'>
  • Prefer global state over local state
  • Prefer props over state
  • Prefer no props over props
    • Prefer component over props
    • Prefer children over props
  • using the ReactComponent#defaultPropos field
  • Keep class ordering (maybe there is a eslint rule for that)
  • Use tailwind themes for a consistent color scheme Use tailwind thems for more consistent styling #30

Finally I think writing style variants in maps is a good pattern.

const VARIANT_MAPS: Record<BadgeVariant, string> = {
  [BadgeVariant.ERROR]: 'bg-red-100 text-red-800',
  [BadgeVariant.NOTE]: 'bg-yellow-100 text-yellow-800',
  [BadgeVariant.SUCCESS]: 'bg-green-100 text-green-800',
  [BadgeVariant.INFO]: 'bg-blue-100 text-blue-800',
};
@Comeza Comeza added the frontend About the Frontend (liberica) label May 16, 2024
@Comeza Comeza added this to the O-Phase 24 milestone May 16, 2024
@Comeza Comeza self-assigned this May 16, 2024
@Comeza Comeza linked a pull request Jun 2, 2024 that will close this issue
6 tasks
@Comeza Comeza linked a pull request Jun 2, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend About the Frontend (liberica)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant