-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add button link as styles function, introduce tailwind-merge #593
base: main
Are you sure you want to change the base?
Conversation
} from '$lib'; | ||
import { uniqueId } from 'lodash-es'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some import sorting.
@@ -193,7 +194,6 @@ console.log(\`The FizzBuzz sequence for n = 15 is:\`); | |||
console.log(sequence); // Outputs: ["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]`.trim(); | |||
|
|||
const goSnippet = ` | |||
import "fmt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter actually hates this, will fix later.
</a> | ||
</div> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create a better example if we decide to go this way.
pnpm-lock.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't reviewed the rest of this PR yet but I wouldn't expect a 22k line diff for the pnpm-lock. pnpm dedupe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran it, still getting those changes. Seems like it is bumping the lockfile version from 6.0
to 9.0
and doing any allowed minor/patch bumps on all dependencies. I freshly cloned the repo and installed so may be related to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very much in favor of this change, but I think for now, we should avoid tailwind-merge
. From their docs:
Reasons not to use it
Generally speaking, there are situations where you could use tailwind-merge but probably shouldn't. Think of tailwind-merge as an escape hatch rather than the primary tool to handle style variants.1
I think for now we should keep Prime on classnames
, and add tailwind-merge
to the places where we need to do overrides. I imagine then that we can look at our twMerge
callsites and use that to refine the APIs of our style functions
I am okay with not doing it for now, but buttons and inputs are probably our most commonly overwritten components style-wise. It is hard to find all of the cases where we are using the important operator in use since the I'd also argue that the usage here is kind of an escape hatch. Extra classes are the "I need to change the styles of this component, but it shouldn't require a new variant" lever we can pull. We could only use |
Yeah definitely feeling the pain, and I think replacing e.g. If we see |
Yeah that's fair. |
@@ -15,3 +15,16 @@ button { | |||
:host([hidden]) { | |||
display: none; | |||
} | |||
|
|||
/* Just give me the CSS classes option */ | |||
.button-link { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't look like anything here is related to link
, should we just call this .button
? My assumption when looking at this name is that it's a special collection for link buttons, when it's just the primary button styles.
Proposing an idea here. We want to move the button link from
app
toprime
, but after some recent conversations, I wonder if we instead just want to export a function to generate the styles for a button link. It will allow us to use the tools already built to support a native<a />
element, including things like autocompleting forrel
andtarget
, which our button link implementation limits. It also creates pretty easy-to-test little units.Another thing I introduced was
tailwind-merge
, which works a lot likeclassnames
but also merges tailwind classes down to avoid conflicting styles. With the way we useextraClasses
this allows an easy way to actually override styles without having to use important tags.