-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(Next): setup and config * fix: import scss without TS error * feat(Next): PrimaryButton, OutlineButton added, testing sass config * chore: changeset
- Loading branch information
billgil
authored
Jun 12, 2023
1 parent
355a35d
commit 44d67b5
Showing
44 changed files
with
949 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@web3uikit/nextJs': patch | ||
'@web3uikit/styles': patch | ||
--- | ||
|
||
feat(NextJs): added new slice for testing with Money repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,35 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": [ | ||
"**/*" | ||
], | ||
"plugins": [ | ||
"@nrwl/nx" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx", | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"rules": { | ||
"@nrwl/nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": [ | ||
"*" | ||
"root": true, | ||
"ignorePatterns": ["**/*"], | ||
"plugins": ["@nrwl/nx"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nrwl/nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx" | ||
], | ||
"extends": [ | ||
"plugin:@nrwl/nx/typescript" | ||
], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"extends": [ | ||
"plugin:@nrwl/nx/javascript" | ||
], | ||
"rules": {} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.scss"], | ||
"extends": ["plugin:@nrwl/nx/typescript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"extends": ["plugin:@nrwl/nx/javascript"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# @web3uikit/web3api | ||
# @web3uikit/nextJs | ||
|
||
## 0.2.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.module.scss' { | ||
const classes: { [key: string]: string }; | ||
export default classes; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use client'; | ||
import { FC } from 'react'; | ||
import { IButtonProps } from './types'; | ||
import styles from './styles.module.scss'; | ||
|
||
const ButtonBase: FC<IButtonProps> = ({ | ||
children, | ||
className, | ||
disabled = false, | ||
onClick, | ||
size = 'regular', | ||
style, | ||
type = 'button', | ||
...props | ||
}) => { | ||
const getSizeStyles = (size: string) => { | ||
switch (size) { | ||
case 'large': | ||
return styles.buttonLarge; | ||
case 'small': | ||
return styles.buttonSmall; | ||
case 'xl': | ||
return styles.buttonXL; | ||
default: | ||
return styles.buttonRegular; | ||
} | ||
}; | ||
return ( | ||
<button | ||
className={` | ||
web3uiKit-button | ||
${styles.button} | ||
${getSizeStyles(size)} | ||
${className} | ||
`} | ||
disabled={disabled} | ||
onClick={onClick} | ||
style={{ ...style }} | ||
type={type} | ||
{...props} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default ButtonBase; |
47 changes: 47 additions & 0 deletions
47
packages/nextJs/src/lib/Button/ButtonOutline/Button.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import ButtonOutline from './ButtonOutline'; | ||
|
||
export default { | ||
title: '9.NextJS/Button/Outline', | ||
component: ButtonOutline, | ||
argTypes: { onClick: { action: 'clicked' } }, | ||
} as ComponentMeta<typeof ButtonOutline>; | ||
|
||
const Template: ComponentStory<typeof ButtonOutline> = (args) => ( | ||
<ButtonOutline {...args} /> | ||
); | ||
|
||
export const Outline = Template.bind({}); | ||
Outline.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
}; | ||
|
||
export const Disabled = Template.bind({}); | ||
Disabled.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
disabled: true, | ||
}; | ||
|
||
export const SizeXL = Template.bind({}); | ||
SizeXL.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'xl', | ||
}; | ||
|
||
export const SizeLarge = Template.bind({}); | ||
SizeLarge.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'large', | ||
}; | ||
|
||
export const SizeRegular = Template.bind({}); | ||
SizeRegular.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'regular', | ||
}; | ||
|
||
export const SizeSmall = Template.bind({}); | ||
SizeSmall.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'small', | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/nextJs/src/lib/Button/ButtonOutline/ButtonOutline.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use client'; | ||
import { FC } from 'react'; | ||
import { IButtonProps } from '../types'; | ||
import ButtonBase from '../ButtonBase'; | ||
import styles from './styles.module.scss'; | ||
|
||
const ButtonOutline: FC<IButtonProps> = ({ ...props }: IButtonProps) => { | ||
return <ButtonBase className={styles.outline} {...props} />; | ||
}; | ||
|
||
export default ButtonOutline; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as ButtonOutline } from './ButtonOutline'; | ||
export type { IButtonProps } from '../types'; |
16 changes: 16 additions & 0 deletions
16
packages/nextJs/src/lib/Button/ButtonOutline/styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@use '../../../styles/modules/color' as color; | ||
|
||
.outline { | ||
background-color: color.$color-white; | ||
border-color: color.$color-primary60; | ||
color: color.$color-primary30; | ||
&:hover { | ||
background-color: color.$color-primary70; | ||
} | ||
&:focus { | ||
border-color: color.$color-primary30; | ||
} | ||
&:active { | ||
background-color: color.$color-primary50; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
packages/nextJs/src/lib/Button/ButtonPrimary/Button.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import ButtonPrimary from './ButtonPrimary'; | ||
|
||
export default { | ||
title: '9.NextJS/Button/Primary', | ||
component: ButtonPrimary, | ||
argTypes: { onClick: { action: 'clicked' } }, | ||
} as ComponentMeta<typeof ButtonPrimary>; | ||
|
||
const Template: ComponentStory<typeof ButtonPrimary> = (args) => ( | ||
<ButtonPrimary {...args} /> | ||
); | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
}; | ||
|
||
export const Disabled = Template.bind({}); | ||
Disabled.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
disabled: true, | ||
}; | ||
|
||
export const SizeXL = Template.bind({}); | ||
SizeXL.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'xl', | ||
}; | ||
|
||
export const SizeLarge = Template.bind({}); | ||
SizeLarge.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'large', | ||
}; | ||
|
||
export const SizeRegular = Template.bind({}); | ||
SizeRegular.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'regular', | ||
}; | ||
|
||
export const SizeSmall = Template.bind({}); | ||
SizeSmall.args = { | ||
children: <span>Good to use with NextJS</span>, | ||
size: 'small', | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/nextJs/src/lib/Button/ButtonPrimary/ButtonPrimary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use client'; | ||
import { FC } from 'react'; | ||
import { IButtonProps } from '../types'; | ||
import ButtonBase from '../ButtonBase'; | ||
import styles from './styles.module.scss'; | ||
|
||
const ButtonPrimary: FC<IButtonProps> = ({ ...props }: IButtonProps) => { | ||
return <ButtonBase className={styles.primary} {...props} />; | ||
}; | ||
|
||
export default ButtonPrimary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as ButtonPrimary } from './ButtonPrimary'; | ||
export type { IButtonProps } from '../types'; |
11 changes: 11 additions & 0 deletions
11
packages/nextJs/src/lib/Button/ButtonPrimary/styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@use '../../../styles/modules/color' as color; | ||
|
||
.primary { | ||
background-color: color.$color-primary40; | ||
&:hover { | ||
background-color: color.$color-primary30; | ||
} | ||
&:focus { | ||
border-color: color.$color-primary60; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as ButtonBase } from './ButtonBase'; | ||
export type { IButtonProps } from './types'; |
Oops, something went wrong.