Skip to content

Substitute every occurrence of true ? “” : “” in className with cn function #47

@vitorsaa2k

Description

@vitorsaa2k
  • Goal: Reduce bugs and increase code quality
  • Depends On: None

Description

The old way of handling conditional css-classes should be replaced with the cn function from the libs folder

for example:

className={`border-slate-800 min-w-[124px] flex flex-col box-border ${
			method === currentMethod ? "border-white" : ""
			} border-2 p-8 rounded justify-center items-center`}

should be replaced with:

className={cn("border-slate-800 min-w-[124px] flex flex-col box-border border-2 p-8 rounded justify-center items-center",
		{
			"border-white": method === currentMethod
		}
)}

Tips on how to solve/should be solved

Tip

you can search for ? “ (this exact string) for finding the occurrences

To do

  1. Find all ocurrences of the conditional classes
  2. Substitute for the cn function

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions