Skip to content

Commit

Permalink
fix: changed import style to fix missing api table (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
wp-aberg authored Jan 4, 2023
1 parent 0b0b403 commit 0338e1a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ module.exports = {
rules: {
"react/prop-types": "off",
"@washingtonpost/wpds/theme-colors": "warn",
"no-restricted-syntax": [
"error",
{
selector:
"ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
message: "Default React import not allowed",
},
],
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion build.washingtonpost.com/pages/working-examples/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from "react";
import * as React from "react";
import { useState } from "react";
import { useForm, Controller } from "react-hook-form";
import { isPossiblePhoneNumber } from "react-phone-number-input";
import {
Expand Down
8 changes: 4 additions & 4 deletions ui/input-text/src/InputText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from "react";
import * as React from "react";
import { useEffect, useState } from "react";
import { nanoid } from "nanoid";
import { theme, styled } from "@washingtonpost/wpds-theme";
import { Button } from "@washingtonpost/wpds-button";
Expand Down Expand Up @@ -139,8 +140,6 @@ export const InputText = React.forwardRef<HTMLInputElement, InputTextProps>(
},
ref
) => {
globalInputAutoFillTriggerAnimations();

const [helperId, setHelperId] = useState<string | undefined>();
const [errorId, setErrorId] = useState<string | undefined>();
const [isAutofilled, setIsAutofilled] = useState<boolean>(false);
Expand All @@ -163,6 +162,7 @@ export const InputText = React.forwardRef<HTMLInputElement, InputTextProps>(
}, [ref, internalRef]);

useEffect(() => {
globalInputAutoFillTriggerAnimations();
const element = internalRef.current;

const onAnimationStart = (e) => {
Expand All @@ -179,7 +179,7 @@ export const InputText = React.forwardRef<HTMLInputElement, InputTextProps>(
return () => {
element?.removeEventListener("animationstart", onAnimationStart, false);
};
});
}, []);

const [isFloating, handleOnFocus, handleOnBlur, handleOnChange] =
useFloating(
Expand Down
9 changes: 3 additions & 6 deletions ui/input-textarea/src/InputTextarea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from "react";
import { useEffect, useState } from "react";
import { nanoid } from "nanoid";
import { theme, css, styled } from "@washingtonpost/wpds-theme";
import type * as WPDS from "@washingtonpost/wpds-theme";
Expand All @@ -12,8 +13,6 @@ import { InputLabel } from "@washingtonpost/wpds-input-label";
import { ErrorMessage } from "@washingtonpost/wpds-error-message";
import { HelperText } from "@washingtonpost/wpds-helper-text";

import { useEffect, useState } from "react";

const NAME = "InputTextarea";

const InputTextareaCSS = css({
Expand Down Expand Up @@ -122,8 +121,6 @@ export const InputTextarea = React.forwardRef<
},
ref
) => {
globalInputAutoFillTriggerAnimations();

const [helperId, setHelperId] = useState<string | undefined>();
const [errorId, setErrorId] = useState<string | undefined>();
const [isAutofilled, setIsAutofilled] = useState<boolean>(false);
Expand All @@ -147,10 +144,10 @@ export const InputTextarea = React.forwardRef<
}, [ref, internalRef]);

useEffect(() => {
globalInputAutoFillTriggerAnimations();
const element = internalRef.current;

const onAnimationStart = (e) => {
console.log(e.animationName);
switch (e.animationName) {
case "jsTriggerAutoFillStart":
return setIsAutofilled(true);
Expand All @@ -164,7 +161,7 @@ export const InputTextarea = React.forwardRef<
return () => {
element?.removeEventListener("animationstart", onAnimationStart, false);
};
});
}, []);

const [isFloating, handleFocus, handleBlur, handleChange] = useFloating(
value || defaultValue || placeholder || isAutofilled,
Expand Down

2 comments on commit 0338e1a

@vercel
Copy link

@vercel vercel bot commented on 0338e1a Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit – ./build.washingtonpost.com

build.washingtonpost.com
wpds-ui-kit-git-main.preview.now.washingtonpost.com
wpds-ui-kit.preview.now.washingtonpost.com

@vercel
Copy link

@vercel vercel bot commented on 0338e1a Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit-storybook – ./

wpds-ui-kit-storybook-git-main.preview.now.washingtonpost.com
wpds-ui-kit-storybook.preview.now.washingtonpost.com

Please sign in to comment.