-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Tailwind-based UI package #1891
Conversation
|
* be produced from the `getThemeColorClass` function. */ | ||
export const COLOR_CLASS_MAP: Record<ThemeColor, [string, string]> = { | ||
'neutral.main': ['text-neutral-main', 'bg-neutral-main'], | ||
'neutral.light': ['text-neutral-light', 'bg-neutral-light'], |
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.
this color mapping is needed for Tailwind's compiler. It needs to see static classes, dynamic ones fail to be parsed
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.
What a heroic effort on this 🎊 . Huge win getting this fixed.
|
||
import { Card } from '.'; | ||
|
||
// import storiesBg from './storiesBg.jpg'; |
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.
nit: remove
|
||
render: function Render({ as, title }) { | ||
const [tab, setTab] = useState('one'); | ||
// const [textInput, setTextInput] = useState(''); |
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.
nit: remove
.changeset/wise-toes-bathe.md
Outdated
--- | ||
'@penumbra-zone/ui': major | ||
--- |
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.
Ideally we can:
- rename our old package to
@penumbra-zone/ui-deprecated
and set it to private - name the new package
@penumbra-zone/ui
, set it as the old version12.4.0
, and keep this major bump for that. After changeset versions everything, it should publish the new stuff.
However, this probably requires changing all the import paths. Maybe good for a next PR?
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.
Did it here: #1902
export const withPenumbra = (config: Config): Config => { | ||
return { | ||
...config, | ||
content: composeContent(config.content), | ||
theme: { | ||
...config.theme, | ||
extend: { | ||
...tailwindConfig.theme.extend, | ||
...config.theme?.extend, | ||
}, | ||
}, | ||
}; | ||
}; |
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.
question: does this guarantee no conflicts with the consumers existing styles?
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.
probably no, ideally it should recursively merge all nested fields, especially in the theme.extend
object. That is on my list of future improvements to the library along with exporting the whole .css
file of the library
3475bd2
to
8c9d23f
Compare
@grod220 do you have the idea why the tests are failing in the minifront? Seems like it is triggered by your changes https://github.com/penumbra-zone/web/actions/runs/11724483746/job/32658624212?pr=1891 |
The "multiple copies of react" issue sounds like you are bundling react with the tailwind package. Think that means you need to make it a peerDep and not a main dependency. |
bed74bd
to
4e49ce9
Compare
Followed up by #1902
The Tailwind-based UI library.
Vite, in this case, builds the library code and produces simple JavaScript that takes React's
createElement
and applies the right classes to it. The styling responsibility for now is on the consumer's side. However, I exported one function for simple Tailwind configuration of consumer'stailwind.config.ts
:Components list. Agenda: ✅ – implemented, 🟡 – not implemented (not needed for now), ❌ – i decided not to implement it.
Future work
withPenumbra
hook to cover all config merging cases.css
file with all compiled Tailwind classes, so consumers wouldn't need Tailwind in their projects