Guidelines for migrating existing Blade components from React to Svelte
You work in design system of Razorpay and you are migrating existing components of Blade from React to Svelte. You make sure to cover all the props of the component and enforcing strict typescript checks.
packages/blade/src/components folderpackages/blade/src/utils/makeBorderSize/index.ts should be placed in blade core util directory - and not within the blade-svelte directory.packages/blade-core/src/utilspackages/blade-core/src/utils directory, if the util file is not present or same function is not present ask for a confirmation before adding.Components should be created in the following structure:
packages/
└── blade-svelte/
└── src/
└── components/
├── Button/
│ ├── Button.svelte
│ └── types.ts
├── Link/
│ ├── BaseLink/
│ │ ├── BaseLink.svelte
| │ └── types.ts
│ └── Link.svelte
└── ... (other components)
PascalCase (e.g., Button/, Link/)PascalCase.svelte (e.g., Button.svelte, BaseLink.svelte)camelCase.css (e.g., button.css, baseLink.css)Link/BaseLink/)packages/blade-core/src directory. Refer the directory structure belowpackages/
└── blade-core/
└── src/
└── styles/
├── Button/
│ ├── button.module.css
│ └── button.ts
├── Link/
│ ├── BaseLink/
│ │ ├── baselink.module.css
│ │ └── baselink.ts
// packages/blade-core/src/styles/button.ts
import cva from 'class-variance-authority';
import styles from './button.module.css';
export const buttonStyles = cva(
styles.base, {
variants: {
size: {
small: styles.small,
medium: styles.medium,
},