Skip to content

Commit

Permalink
feat: adding mode prop to all components (#374)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Enhanced component customization with the introduction of
`globalState` in the `Provider` component and the `mode` property across
various components for improved theme control.
- Expanded monitoring capabilities with new directory path monitoring
for nodemon.

- **Documentation**
- Updated component documentation to reflect new properties and adjusted
JSX structure for clearer guidance.

- **Refactor**
- Unified property naming by switching from `kind` and `focus` to `mode`
and `focusMode` across components, improving consistency and
expandability.
    - Removed unused CSS classes and styles for cleaner codebase.

- **Style**
- Adjusted media queries and styles for light color schemes, and updated
component styling to align with the new `mode` property.

- **Chores**
- Updated dependencies, including the addition of `@versini/ui-plugins`
to improve development workflow and component functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
aversini authored Mar 5, 2024
1 parent a411cbb commit 71e06d8
Show file tree
Hide file tree
Showing 101 changed files with 1,642 additions and 1,160 deletions.
33 changes: 0 additions & 33 deletions lib/customCSS.ts

This file was deleted.

180 changes: 0 additions & 180 deletions lib/tailwindPlugin.ts

This file was deleted.

93 changes: 0 additions & 93 deletions lib/tokens.ts

This file was deleted.

20 changes: 14 additions & 6 deletions packages/documentation/.ladle/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,23 @@ const renderImportLine = ({
</Flexgrid>

<pre className="mt-0">
<code>{`import { ${importName} } from "@versini/${packageName}";`}</code>
<code className="text-wrap">{`import { ${importName} } from "@versini/${packageName}";`}</code>
</pre>
</div>
);
};

export const Provider: GlobalProvider = ({ children, storyMeta }) => {
export const Provider: GlobalProvider = ({
children,
storyMeta,
globalState,
}) => {
const className = clsx(
"prose prose-lighter mt-0 flex w-full flex-col p-2 sm:mt-3 md:mx-auto md:max-w-4xl",
"prose mt-0 flex w-full flex-col p-2 sm:mt-3 md:mx-auto md:max-w-4xl",
{
"prose-dark dark:prose-lighter":
!globalState?.story.startsWith("system--typography"),
},
);
const handleOnClickGitHub = () => {
window.open(import.meta.env.REPOSITORY, "_blank", "noopener,noreferrer");
Expand All @@ -76,12 +84,12 @@ export const Provider: GlobalProvider = ({ children, storyMeta }) => {
{children}
</div>
<Footer
kind="light"
mode="system"
row1={
<ButtonIcon
noBorder
size="small"
kind="light"
mode="system"
spacing={{ b: 2 }}
label="link to UI Components GitHub repository"
onClick={handleOnClickGitHub}
Expand All @@ -90,7 +98,7 @@ export const Provider: GlobalProvider = ({ children, storyMeta }) => {
</ButtonIcon>
}
row2={
<div className="text-copy-lighter">
<div>
UI Components v{import.meta.env.BUILDVERSION} - &copy;{" "}
{new Date().getFullYear()} {import.meta.env.OWNER}
</div>
Expand Down
4 changes: 3 additions & 1 deletion packages/documentation/.ladle/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default {
"System*",
],
appendToHead: `
<style>html, body, .ladle-background {background-color:rgb(100 116 139)}</style>
<style>
// .ladle-background {background-color:rgb(100 116 139)}
</style>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">
Expand Down
4 changes: 2 additions & 2 deletions packages/documentation/.ladle/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
}

/* @media (prefers-color-scheme: light) {
@media (prefers-color-scheme: light) {
html,
body,
.ladle-background {
Expand All @@ -21,4 +21,4 @@
.ladle-background {
background-color: rgb(100 116 139);
}
} */
}
3 changes: 2 additions & 1 deletion packages/documentation/nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
".ladle/*.*",
"src/**/*.*",
"../ui-components/src/**/*.*",
"../ui-components/lib/**/*.*"
"../ui-components/lib/**/*.*",
"../ui-plugins/src/**/*.*"
]
}
Loading

0 comments on commit 71e06d8

Please sign in to comment.