Skip to content

Commit

Permalink
[C] update types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed Jul 9, 2024
1 parent ba42d19 commit 2d64467
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 37 deletions.
7 changes: 5 additions & 2 deletions packages/epo-widget-lib/src/atomic/Blinker/Blinker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import {
useState,
MouseEventHandler,
} from "react";
import { ImageShape } from "@rubin-epo/epo-react-lib/Image";
import { getClampedArrayIndex } from "@/lib/utils";
import useInterval from "@/hooks/useInterval";
import ImageStack from "../ImageStack";
import Controls from "./Controls/Controls";
import * as Styled from "./styles";

export interface BlinkerProps {
images: ImageShape[];
images: {
url: string;
width?: number;
height?: number;
}[];
activeIndex: number;
autoplay?: boolean;
loop?: boolean;
Expand Down
6 changes: 5 additions & 1 deletion packages/epo-widget-lib/src/atomic/Blinker/_mocks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ImageShape } from "@rubin-epo/epo-react-lib/Image";

export const mockImages: ImageShape[] = [
export const mockImages: Array<{
url: string;
width?: number;
height?: number;
}> = [
{
url: "https://rubin.canto.com/direct/image/4j5ucvv3gd61r1ilkl5kno1111/VFWbyjyDSQt66VtSnyvU0UxruMw/original?content-type=image%2Fjpeg&name=1464149233715_sci.jpg",
},
Expand Down
6 changes: 5 additions & 1 deletion packages/epo-widget-lib/src/atomic/ImageStack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import after from "lodash/after";
import * as Styled from "./styles";

export interface ImageStackProps {
images: Array<ImageShape>;
images: Array<{
url: string;
width?: number;
height?: number;
}>;
visible?: number | Array<boolean>;
describedById?: string;
loadCallback?: () => void;
Expand Down
6 changes: 5 additions & 1 deletion packages/epo-widget-lib/src/types/astro.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export interface BaseAlert {
}

export interface Alert extends BaseAlert {
image: ImageShape;
image: {
url: string;
width?: number;
height?: number;
};
}

export interface SourceDataset {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ const SelectionList: FunctionComponent<SelectionListProps> = ({
const { t } = useTranslation();
return (
<Styled.SelectionWrapper>
<Styled.SelectionList className={className}>
{sources.map(({ type, id }) => {
return (
<Styled.DescriptionWrapper key={id}>
<dt>
{t("source_selector.selected_source", {
type: t(`source_selector.sources.${type}`),
})}
</dt>
<dd>{id}</dd>
</Styled.DescriptionWrapper>
);
})}
</Styled.SelectionList>
{sources.length > 0 && (
<Styled.SelectionList className={className}>
{sources.map(({ type, id }) => {
return (
<Styled.DescriptionWrapper key={id}>
<dt>
{t("source_selector.selected_source", {
type: t(`source_selector.sources.${type}`),
})}
</dt>
<dd>{id}</dd>
</Styled.DescriptionWrapper>
);
})}
</Styled.SelectionList>
)}
<Reset
isDisabled={sources.length < 1}
onResetCallback={onRemoveCallback}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const SelectionWrapper = styled.div`
export const SelectionList = styled.dl`
display: flex;
flex-direction: column;
color: var(--neutral95, #1f2121);
gap: calc(var(--PADDING_SMALL, 20px) / 2);
margin: 0;
padding: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
FunctionComponent,
MouseEventHandler,
ReactNode,
useId,
useState,
} from "react";
import { Alert, Source } from "@/types/astro";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled from "styled-components";
import Blinker from "@/atomic/Blinker";

export const BackgroundBlinker = styled(Blinker)`
cursor: pointer;
position: absolute;
width: 100%;
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const getRadius = (type: string, radius?: number | string): number => {
if (radius) {
if (typeof radius === "number") return Math.abs(radius);

return parseFloat(radius);
return toDecimalPercent(radius);
}

const { [type]: r = 0.04 } = defaultRadii;
Expand Down
15 changes: 0 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3464,21 +3464,6 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@rubin-epo/epo-react-lib@^2.0.32":
version "2.0.32"
resolved "https://registry.yarnpkg.com/@rubin-epo/epo-react-lib/-/epo-react-lib-2.0.32.tgz#ef2146ccc150cc37853584e9f191a22ac1f045eb"
integrity sha512-ACT0GNVQiSIWK01/38xM4SNsKU40gs2MsDkbtr7kbmb8z+RsKla5sU2J4DcdUJFmd7muAhgxuYzSGse23Nc57g==
dependencies:
"@castiron/style-mixins" "^1.0.6"
"@headlessui/react" "^2.0.3"
flickity "^3.0.0"
focus-trap "^7.4.2"
lodash "^4.17.21"
react-player "^2.14.1"
react-share "^4.4.1"
react-slider "^2.0.6"
styled-components "^6.1.1"

"@rushstack/eslint-patch@^1.10.1":
version "1.10.2"
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.10.2.tgz#053f1540703faa81dea2966b768ee5581c66aeda"
Expand Down

0 comments on commit 2d64467

Please sign in to comment.