Skip to content

Commit 275a605

Browse files
authored
Merge branch 'main' into releases/december-2024
2 parents a8a771b + 499c561 commit 275a605

File tree

7 files changed

+202
-19
lines changed

7 files changed

+202
-19
lines changed

.changeset/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3-
"changelog": ["@changesets/changelog-github", { "repo": "refinedev/refine" }],
3+
"changelog": ["./format.js", { "repo": "refinedev/refine" }],
44
"commit": false,
55
"fixed": [],
66
"linked": [],

.changeset/format.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const clgh = require("@changesets/changelog-github");
2+
3+
const changelogFunctions = {
4+
getDependencyReleaseLine: clgh.default.getDependencyReleaseLine,
5+
getReleaseLine: async (changeset, tag, options) => {
6+
const defaultChangeset = await clgh.default.getReleaseLine(
7+
changeset,
8+
tag,
9+
options,
10+
);
11+
12+
const isValid = ["community", "enterprise"].includes(
13+
process.env.REFINE_RELEASE_TYPE,
14+
);
15+
16+
if (!isValid) {
17+
console.error(
18+
"❌ REFINE_RELEASE_TYPE must be either community or enterprise",
19+
);
20+
21+
process.exit(1);
22+
}
23+
24+
let title = "";
25+
26+
if (process.env.REFINE_RELEASE_TYPE === "community") {
27+
title = "\n\n📢 **Refine Community Release** 📢";
28+
}
29+
30+
if (process.env.REFINE_RELEASE_TYPE === "enterprise") {
31+
title = "\n\n⚡ **Refine Enterprise Release** ⚡";
32+
}
33+
34+
const result = title + defaultChangeset;
35+
36+
return result;
37+
},
38+
};
39+
40+
exports.default = changelogFunctions;

.cursorignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.biome/
2+
.codesandbox/
3+
.husky/
4+
.vscode/
5+
cypress/
6+
documentation/
7+
examples/
8+
hackathon/
9+
patches/
10+
pnpm-lock.yaml
11+
CHANGELOG.md
12+
CODE_OF_CONDUCT.md
13+
CONTRIBUTING.md
14+
LICENSE
15+
README.md
16+
SECURITY.md
17+
*.md
18+
packages/**/tsconfig.json
19+
packages/**/tsconfig.test.json
20+
packages/**/tsconfig.declarations.json
21+
packages/**/jest.config.js
22+
packages/**/refine.config.js
23+
packages/**/tsup.config.ts

.github/workflows/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ jobs:
9595
timeout-minutes: 15
9696
- name: Check Existing Links in Documentation
9797
if: ${{ github.ref != 'refs/heads/main' && steps.netlify-deploy.outputs.deploy-url }}
98-
run: DEPLOY_URL=${{ steps.netlify-deploy.outputs.deploy-url }} SITEMAP_URL=${{steps.netlify-deploy.outputs.deploy-url}}/sitemap.xml node ./.github/workflows/scripts/check-existing-doc-links.js
98+
run: DEPLOY_URL=${{ steps.netlify-deploy.outputs.deploy-url }} SITEMAP_URL=https://refine.dev/sitemap.xml node ./.github/workflows/scripts/check-existing-doc-links.js

.github/workflows/refine-registry-release.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- "packages/**"
88
branches:
99
- next
10+
- releases/december-2024
11+
12+
env:
13+
RELEASE_ONLY: ${{ secrets.RELEASE_ONLY }}
1014

1115
jobs:
1216
publish:
@@ -37,31 +41,32 @@ jobs:
3741
run: pnpm install
3842
- name: Lint
3943
run: pnpm lint:ci
40-
if: ${{ env.RELEASE_ONLY != 'true' }}
44+
if: ${{ env.RELEASE_ONLY != 'YES' }}
4145
- name: Syncpack
4246
run: pnpm sp lint
43-
if: ${{ env.RELEASE_ONLY != 'true' }}
47+
if: ${{ env.RELEASE_ONLY != 'YES' }}
4448
- name: Publint
4549
run: pnpm publint:all
46-
if: ${{ env.RELEASE_ONLY != 'true' }}
50+
if: ${{ env.RELEASE_ONLY != 'YES' }}
4751
- name: Are The Types Wrong
4852
run: pnpm attw:all
49-
if: ${{ env.RELEASE_ONLY != 'true' }}
53+
if: ${{ env.RELEASE_ONLY != 'YES' }}
5054
- name: Test
5155
run: pnpm test:all
52-
if: ${{ env.RELEASE_ONLY != 'true' }}
56+
if: ${{ env.RELEASE_ONLY != 'YES' }}
5357
- name: Copy changesets for Community version
5458
run: mkdir -p ./_changeset/ && cp -r ./.changeset/* ./_changeset/
5559
- name: Create Release Pull Request or Publish to npm
5660
id: changesets
5761
uses: changesets/action@v1
5862
with:
5963
version: pnpm version-packages
60-
publish: pnpm changeset publish --tag next
64+
publish: pnpm changeset publish
6165
commit: "ci(changesets): refine registry version packages"
6266
title: "ci(changesets): refine registry version packages"
6367
createGithubReleases: false
6468
env:
6569
GITHUB_TOKEN: ${{ secrets.PANKOD_BOT_TOKEN }}
6670
NPM_TOKEN: ${{ secrets.REFINE_REGISTRY_TOKEN }}
67-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
71+
NODE_AUTH_TOKEN: ${{ secrets.REFINE_REGISTRY_TOKEN }}
72+
REFINE_RELEASE_TYPE: enterprise

.github/workflows/release.yml

+18-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ jobs:
5353
- name: Test
5454
run: pnpm test:all
5555
if: ${{ env.RELEASE_ONLY != 'true' }}
56+
- name: Prepare Community Edition version changesets
57+
if: "!contains(github.event.head_commit.message, 'ci(changesets): version packages')"
58+
run: |
59+
cp -R ./_changeset/* ./.changeset || : && rm -rf ./_changeset/
5660
- name: Create Release Pull Request or Publish to npm
5761
id: changesets
5862
uses: changesets/action@v1
@@ -64,4 +68,17 @@ jobs:
6468
env:
6569
GITHUB_TOKEN: ${{ secrets.PANKOD_BOT_TOKEN }}
6670
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
71+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72+
REFINE_RELEASE_TYPE: community
73+
- name: Merge main to next
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.PANKOD_BOT_TOKEN }}
76+
GIT_USER_EMAIL: [email protected]
77+
GIT_USER_NAME: Refine Community Bot
78+
if: steps.changesets.outputs.published == 'true'
79+
run: |
80+
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
81+
git config --global user.name "${{ env.GIT_USER_NAME }}"
82+
git checkout next
83+
git merge main
84+
git push origin next

documentation/blog/2022-09-05-mui-button.md documentation/blog/2024-12-10-mui-button.md

+107-9
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,34 @@ image: https://refine.ams3.cdn.digitaloceanspaces.com/blog/2022-09-05-mui-button
88
hide_table_of_contents: false
99
---
1010

11+
**This article was last updated on December 10, 2024, to include new sections on Accessibility, Button Animations, and Performance Optimization for Material UI Buttons.**
12+
1113
## Introduction
1214

15+
TL DR:
16+
17+
Briefly, the Material Button is one of the keys in the Material UI user interface through which a React library will allow users or any end user to perform particular actions or make such decisions just with taps or clicks. The variants are available mainly in three forms:
18+
• Text Button: A low-emphasis button for actions like “Cancel.”
19+
• Contained Button: A high-emphasis button with a filled background. It is used for the most important actions, such as those labeled “Submit.”
20+
• Outlined Button: A medium-emphasis button with a border; this is often used for secondary actions.
21+
22+
Material-UI provides a customizable button with various color and size options, icons, and even loading indicators for asynchronous actions.
23+
1324
Material UI is a dynamic React library because it provides numerous component infrastructures for responsive web design. One such essential component is the `Button`.
1425

1526
In this article, we will deeply explore the Material UI `Button` component, its variants, and the different ways it can be used in a React application.
1627

17-
<!--truncate-->
18-
1928
Steps we'll cover:
2029

2130
- [What is Material UI](#what-is-material-ui)
2231
- [Getting Started with the Material UI Button component](#getting-started-with-the-material-ui-button-component)
2332
- [How to use Material UI Button Component in your React project](#how-to-use-material-ui-button-component-in-your-react-project)
24-
2533
- [Creating a Calculator UI with light and dark mode using React Material UI Button Component](#creating-a-calculator-ui-with-light-and-dark-mode-using-react-material-ui-button-component)
34+
- [The Navbar Component](#the-navbar-component)
35+
- [Advance Material UI Buttons](#advance-material-ui-buttons)
36+
- [Accessibility (Making Buttons More User-Friendly)](#accessibility-making-buttons-more-user-friendly)
37+
- [Button Animations](#button-animations)
38+
- [The Main Component](#the-main-component)
2639

2740
## What is Material UI
2841

@@ -322,6 +335,55 @@ export default IconLabelButtons;
322335
<br />
323336
<img src="https://refine.ams3.cdn.digitaloceanspaces.com/blog/2022-09-05-mui-button/labelButton.png" alt="labelButton" />
324337

338+
### Performance Optimization for Material UI Buttons
339+
340+
Performance optimization is essential for larger applications to ensure smooth and responsive user experiences. Material UI provides several strategies to reduce app load and improve speed.
341+
342+
### Import Only What You Need
343+
344+
Instead of importing the entire Material UI library, import only the specific components you use. This minimizes the bundle size.
345+
346+
```javascript
347+
// Import only the Button component
348+
import Button from "@mui/material/Button";
349+
```
350+
351+
### Use React.memo
352+
353+
Prevent unnecessary re-renders by wrapping your button components with React.memo. This ensures that the button re-renders only when its props change.
354+
355+
```javascript
356+
import React from "react";
357+
358+
const MyButton = React.memo(({ onClick, label }) => {
359+
return <Button onClick={onClick}>{label}</Button>;
360+
});
361+
362+
export default MyButton;
363+
```
364+
365+
### Lazy Loading
366+
367+
For larger applications, load components only when they are needed using React’s lazy feature. This helps reduce the initial load time.
368+
369+
```javascript
370+
import React, { Suspense } from "react";
371+
372+
const LazyButton = React.lazy(() => import("@mui/material/Button"));
373+
374+
const App = () => (
375+
<Suspense fallback={<div>Loading...</div>}>
376+
<LazyButton>Click Me</LazyButton>
377+
</Suspense>
378+
);
379+
```
380+
381+
Benefits:
382+
383+
- Reduced Bundle Size: Importing only required components lowers the size of your application.
384+
- Improved Rendering Efficiency: Using React.memo prevents unnecessary updates, keeping the UI responsive.
385+
- Faster Load Times: Lazy loading ensures that components are loaded on-demand, optimizing resource usage.
386+
325387
## Creating a Calculator UI with light and dark mode using React Material UI Button Component
326388

327389
**Material UI Buttons** can be used for a variety of purposes in your React application. You can use them to take actions, switch directories and execute specific commands in your app. We can showcase some of their uses and function in a Calculator UI with light and dark mode toggling features.
@@ -381,12 +443,48 @@ Here’s the result:
381443

382444
<img src="https://refine.ams3.cdn.digitaloceanspaces.com/blog/2022-09-05-mui-button/navbar.gif" alt="navbar" />
383445

384-
<br/>
385-
<div>
386-
<a href="https://discord.gg/refine">
387-
<img src="https://refine.ams3.cdn.digitaloceanspaces.com/website/static/img/discord_big_blue.png" alt="discord banner" />
388-
</a>
389-
</div>
446+
## Advance Material UI Buttons
447+
448+
### Accessibility (Making Buttons More User-Friendly)
449+
450+
Accessibility is key to creating inclusive and user-friendly applications. Material UI buttons can be made more accessible by using props such as `aria-label`, `aria-hidden`, or `role`. These attributes make sure proper functionality for screen readers and keyboard navigation.
451+
452+
```jsx
453+
<Button aria-label="Save File">Save</Button>
454+
<Button aria-hidden="true">Hidden Button</Button>
455+
```
456+
457+
Adding these small details makes your application usable for everyone, including users with disabilities.
458+
459+
### Button Animations
460+
461+
Animations can enhance the interactivity of buttons and improve the overall user experience. Material UI allows you to easily implement animations for hover, focus, or click effects.
462+
463+
```jsx
464+
<Button
465+
variant="contained"
466+
sx={{
467+
"&:hover": {
468+
transform: "scale(1.1)",
469+
transition: "all 0.2s ease-in-out",
470+
},
471+
}}
472+
>
473+
Hover Me
474+
</Button>
475+
```
476+
477+
This example adds a smooth zoom effect when the button is hovered over. For more advanced animations, you can use Material UI’s built-in Fade or Grow components.
478+
479+
Example with Fade:
480+
481+
```jsx
482+
<Fade in={true}>
483+
<Button>Animated Button</Button>
484+
</Fade>
485+
```
486+
487+
These features make your buttons more engaging and visually appealing.
390488

391489
### The Main Component
392490

0 commit comments

Comments
 (0)