Skip to content

Commit

Permalink
chore: formatting by prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
shayan-deriv committed Apr 24, 2024
1 parent 9d22be6 commit b6c4e52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/PasswordInput/PasswordUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const isPasswordStrong = (password: string) => {
);
};

export const calculateScore = (password: string, customErrorMessage="") => {
export const calculateScore = (password: string, customErrorMessage = "") => {
if (password?.length === 0) return 0;
if (customErrorMessage) return 5;
if (!isPasswordValid(password)) return 1;
Expand Down
8 changes: 4 additions & 4 deletions src/components/PasswordInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import { EyeIcon, EyeIconSlash } from "./PasswordIcon";
import { PasswordMeter } from "./PasswordMeter";
import "./PasswordInput.scss";

export const validatePassword = (password: string, customErrorMessage="") => {
export const validatePassword = (password: string, customErrorMessage = "") => {
const score = calculateScore(password, customErrorMessage);
let errorMessage = "";

const options = { dictionary: { ...dictionary } };
zxcvbnOptions.setOptions(options);
if(!password){
if (!password) {
return { errorMessage, score };
}
const { feedback } = zxcvbn(password);
Expand All @@ -38,7 +38,7 @@ export const validatePassword = (password: string, customErrorMessage="") => {
} else if (!isPasswordValid(password)) {
errorMessage = passwordErrorMessage.missingCharacter;
}
else if( customErrorMessage){
else if (customErrorMessage) {
errorMessage = customErrorMessage;
}
else {
Expand Down Expand Up @@ -94,7 +94,7 @@ export const PasswordInput = ({
onBlur,
onChange,
value,
customErrorMessage="",
customErrorMessage = "",
...rest
}: PasswordInputProps) => {
useEffect(() => {
Expand Down
14 changes: 7 additions & 7 deletions stories/PasswordInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StoryObj, Meta } from "@storybook/react";
import { PasswordInput } from "../src/main";
import { useState } from "react";
import {Button} from "../src/main";
import { Button } from "../src/main";

const meta = {
title: "Components/PasswordInput",
Expand All @@ -13,7 +13,7 @@ const meta = {
hideMessage: false,
label: "Enter Password",
value: "",
onChange: () => {},
onChange: () => { },
hidePasswordMeter: false,
hint: "This is a hint message",
},
Expand Down Expand Up @@ -55,7 +55,7 @@ export const Default: Story = {
args: {
label: "Enter Password",
value: "",
onChange: () => {},
onChange: () => { },
hidePasswordMeter: false,
hint: "This is a hint message",
},
Expand All @@ -80,7 +80,7 @@ export const HideMessage: Story = {
hideMessage: true,
label: "Enter Password",
value: "",
onChange: () => {},
onChange: () => { },
hidePasswordMeter: false,
hint: "This is a hint message",
},
Expand All @@ -104,7 +104,7 @@ export const HidePasswordMeter: Story = {
args: {
label: "Enter Password",
value: "",
onChange: () => {},
onChange: () => { },
hidePasswordMeter: true,
hint: "This is a hint message",
},
Expand All @@ -128,7 +128,7 @@ export const customErrorMessage: Story = {
args: {
label: "Enter Password",
value: "",
onChange: () => {},
onChange: () => { },
hidePasswordMeter: true,
hint: "This is a hint message",
},
Expand All @@ -138,7 +138,7 @@ export const customErrorMessage: Story = {


return (
<div className="theme--light" style={{display:"flex", flexDirection:"column"}}>
<div className="theme--light" style={{ display: "flex", flexDirection: "column" }}>
<PasswordInput
{...args}
value={value}
Expand Down

0 comments on commit b6c4e52

Please sign in to comment.