-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
374 additions
and
209 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
*.ts linguist-language=typescript | ||
*.tsx linguist-language=typescript | ||
*.tsx linguist-language=react |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"name": "go-captcha-react", | ||
"version": "2.0.0", | ||
"author": "Awen", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"private": false, | ||
"email": "[email protected]", | ||
"author": "Awen <[email protected]>", | ||
"description": "This is the react package for go-captcha", | ||
"keywords": [ | ||
"go-captcha-react", | ||
|
@@ -22,6 +22,7 @@ | |
"type": "git", | ||
"url": "git+https://github.com/wenlng/go-captcha-react.git" | ||
}, | ||
"homepage": "https://github.com/wenlng/go-captcha-react", | ||
"module": "dist/go-captcha-react.esm.js", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
|
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,17 +1,25 @@ | ||
/** | ||
* @Author Awen | ||
* @Date 2024/06/01 | ||
* @Email [email protected] | ||
**/ | ||
|
||
import React, {FC} from "react"; | ||
import {CaptchaConfig, defaultConfig} from "./meta/config"; | ||
import {ButtonConfig, defaultConfig} from "./meta/config"; | ||
import styles from './index.module.less' | ||
import BtnDefaultIcon from "../../assets/icons/BtnDefaultIcon"; | ||
import BtnErrorIcon from "../../assets/icons/BtnErrorIcon"; | ||
import BtnWarnIcon from "../../assets/icons/BtnWarnIcon"; | ||
import BtnSuccessIcon from "../../assets/icons/BtnSuccessIcon"; | ||
import classnames from "classnames"; | ||
|
||
export type ButtonType = "default" | "warn" | "error" | "success"; | ||
|
||
export interface Props extends React.HTMLAttributes<HTMLElement> { | ||
config?: CaptchaConfig; | ||
config?: ButtonConfig; | ||
clickEvent?: () => void; | ||
disabled?: boolean; | ||
type?: "default" | "warn" | "error" | "success"; | ||
type?: ButtonType; | ||
title?: string; | ||
} | ||
|
||
|
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,6 +1,6 @@ | ||
/** | ||
* @Author Awen | ||
* @Date 2024/05/25 | ||
* @Date 2024/06/01 | ||
* @Email [email protected] | ||
**/ | ||
|
||
|
@@ -52,34 +52,38 @@ | |
} | ||
|
||
.default{ | ||
color: #3e7cff; | ||
color: var(--go-captcha-theme-default-color); | ||
border: 1px solid #50a1ff; | ||
background: #ecf5ff; | ||
border-color: var(--go-captcha-theme-default-border-color); | ||
background-color: var(--go-captcha-theme-default-bg-color); | ||
cursor: pointer; | ||
|
||
&:hover{ | ||
background: #e0efff !important; | ||
background-color: var(--go-captcha-theme-default-hover-color) !important; | ||
} | ||
} | ||
|
||
.error{ | ||
cursor: pointer; | ||
color: #ed4630; | ||
background: #fef0f0; | ||
color: var(--go-captcha-theme-error-color); | ||
background-color: var(--go-captcha-theme-error-bg-color); | ||
border: 1px solid #ff5a34; | ||
border-color: var(--go-captcha-theme-error-border-color); | ||
} | ||
|
||
.warn{ | ||
cursor: pointer; | ||
color: #ffa000; | ||
background: #fdf6ec; | ||
color: var(--go-captcha-theme-warn-color); | ||
background-color: var(--go-captcha-theme-warn-bg-color); | ||
border: 1px solid #ffbe09; | ||
border-color: var(--go-captcha-theme-warn-border-color); | ||
} | ||
|
||
.success{ | ||
color: #5eaa2f; | ||
background: #f0f9eb; | ||
color: var(--go-captcha-theme-success-color); | ||
background-color: var(--go-captcha-theme-success-bg-color); | ||
border: 1px solid #8bc640; | ||
border-color: var(--go-captcha-theme-success-border-color); | ||
pointer-events: none; | ||
} | ||
|
||
|
@@ -99,26 +103,30 @@ | |
:global { | ||
svg { | ||
position: relative; | ||
z-index: 10; | ||
z-index: 2; | ||
} | ||
} | ||
|
||
& > *{ | ||
z-index: 2; | ||
} | ||
|
||
&::after { | ||
background: #409eff; | ||
background-color: var(--go-captcha-theme-default-border-color); | ||
-webkit-border-radius: 50px; | ||
-moz-border-radius: 50px; | ||
border-radius: 50px; | ||
content: ""; | ||
display: block; | ||
width: 20px; | ||
height: 20px; | ||
width: 21px; | ||
height: 21px; | ||
opacity: 0; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
margin-top: -10px; | ||
margin-left: -10px; | ||
z-index: 9; | ||
margin-top: -11px; | ||
margin-left: -11px; | ||
z-index: 1; | ||
|
||
animation: ripple 1.3s infinite; | ||
-moz-animation: ripple 1.3s infinite; | ||
|
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,17 +1,17 @@ | ||
/** | ||
* @Author Awen | ||
* @Date 2024/05/25 | ||
* @Date 2024/06/01 | ||
* @Email [email protected] | ||
**/ | ||
|
||
export interface CaptchaConfig { | ||
export interface ButtonConfig { | ||
width?: number; | ||
height?: number; | ||
verticalPadding?: number; | ||
horizontalPadding?: number; | ||
} | ||
|
||
export const defaultConfig = ():CaptchaConfig => ({ | ||
export const defaultConfig = ():ButtonConfig => ({ | ||
width: 330, | ||
height: 44, | ||
verticalPadding: 12, | ||
|
Oops, something went wrong.