Skip to content

Commit

Permalink
Merge pull request #124 from brainstormforce/template/dashboards
Browse files Browse the repository at this point in the history
SUR-285 Template: Implement Dashbaords
  • Loading branch information
vrundakansara authored Oct 14, 2024
2 parents b210078 + 3b131ac commit 79dd6e1
Show file tree
Hide file tree
Showing 10 changed files with 1,659 additions and 149 deletions.
289 changes: 145 additions & 144 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"@storybook/react": "^8.3.3",
"@storybook/react-webpack5": "^8.3.3",
"@storybook/test": "^8.3.3",
"@tailwindcss/container-queries": "^0.1.1",
"@wordpress/eslint-plugin": "^20.3.0",
"@wordpress/prettier-config": "^4.4.0",
"@wordpress/scripts": "^27.9.0",
Expand Down
16 changes: 15 additions & 1 deletion src/components/badge/badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const BadgeComponent = ( props, ref ) => {

// Size classes - Based on the size prop.
const sizeClasses = {
xxs: 'py-0.5 px-0.5 text-xs',
xs: 'py-0.5 px-1 text-xs',
sm: 'py-1 px-1.5 text-xs',
md: 'py-1 px-1.5 text-sm',
Expand Down Expand Up @@ -56,6 +57,14 @@ const BadgeComponent = ( props, ref ) => {
let buttonClasses =
'group relative justify-center flex items-center [&>svg]:h-4 [&>svg]:w-4 cursor-pointer';

const iconSizeClasses = {
xxs: '[&>svg]:size-3',
xs: '[&>svg]:size-3',
sm: '[&>svg]:size-3',
md: '[&>svg]:size-4',
lg: '[&>svg]:size-5',
};

if ( disabled ) {
filteredClasses = variantClasses.disabled;
buttonClasses += ' cursor-not-allowed disabled';
Expand All @@ -79,7 +88,12 @@ const BadgeComponent = ( props, ref ) => {
ref={ ref }
>
{ icon ? (
<span className="justify-center flex items-center [&>svg]:h-4 [&>svg]:w-4">
<span
className={ cn(
'justify-center flex items-center',
iconSizeClasses[ size ]
) }
>
{ icon }
</span>
) : null }
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/badge.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
name: 'Size',
description: 'Defines the size of the badge.',
control: 'select',
options: [ 'xs', 'sm', 'md', 'lg' ],
options: [ 'xxs', 'xs', 'sm', 'md', 'lg' ],
table: {
type: { summary: 'string' },
defaultValue: { summary: 'md' },
Expand Down
9 changes: 7 additions & 2 deletions src/components/switch/switch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,15 @@ const SwitchComponent = (
toggleDial:
'size-4 top-2/4 left-1 -translate-y-2/4 peer-checked:translate-x-5 before:w-10 before:h-10 before:rounded-full before:absolute before:top-2/4 before:left-2/4 before:-translate-y-2/4 before:-translate-x-2/4',
},
md: {
container: 'w-10 h-5',
toggleDial:
'size-3 top-2/4 left-1 -translate-y-2/4 peer-checked:translate-x-5 before:w-10 before:h-10 before:rounded-full before:absolute before:top-2/4 before:left-2/4 before:-translate-y-2/4 before:-translate-x-2/4',
},
sm: {
container: 'w-9 h-5',
container: 'w-8 h-4',
toggleDial:
'size-3 top-2/4 left-1 -translate-y-2/4 peer-checked:translate-x-4 before:w-10 before:h-10 before:rounded-full before:absolute before:top-2/4 before:left-2/4 before:-translate-y-2/4 before:-translate-x-2/4',
'size-2.5 top-2/4 left-1 -translate-y-2/4 peer-checked:translate-x-4 before:w-10 before:h-10 before:rounded-full before:absolute before:top-2/4 before:left-2/4 before:-translate-y-2/4 before:-translate-x-2/4',
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/switch/switch.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
name: 'Size',
description: 'Defines the size of the switch.',
control: 'radio',
options: [ 'sm', 'lg' ],
options: [ 'sm', 'md', 'lg' ],
table: {
type: { summary: 'string' },
defaultValue: { summary: 'lg' },
Expand Down
Loading

0 comments on commit 79dd6e1

Please sign in to comment.