Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New names for widgets (React only) #84

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/thick-bats-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"fogbender-react": minor
---

We're working on standardizing the naming of the widgets, therefore:

- The nameless full-width widget is now known as Roomy (lots of room)
- The floating widget (Floatie) is now known as Floaty (to match the spelling of Roomy)
- We're exporting new names as aliases

FogbenderWidget -> FogbenderRoomyWidget
FogbenderSimpleWidget -> FogbenderSimpleRoomyWidget
FogbenderFloatingWidget -> FogbenderFloatyWidget
FogbenderSimpleFloatie -> FogbenderSimpleFloatyWidget
43 changes: 30 additions & 13 deletions packages/fogbender-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ export {
FogbenderIsConfigured,
};

export const FogbenderSimpleWidget: React.FC<{
type RoomyWidgetProps = {
clientUrl?: string;
env?: Env;
token: Token;
}> = ({ clientUrl, env, token }) => {
};

// old name; new name is FogbenderSimpleRoomyWidget
export const FogbenderSimpleWidget = ({ clientUrl, env, token }: RoomyWidgetProps) => {
const [fogbender, setFogbender] = React.useState(undefined as Fogbender | undefined);
React.useEffect(() => {
const fb = createNewFogbender();
Expand All @@ -39,6 +42,7 @@ export const FogbenderSimpleWidget: React.FC<{
);
};

// old name; new name is FogbenderRoomyWidget
export const FogbenderWidget = () => {
const divRef = React.useRef<HTMLDivElement>(null);
useRenderIframe(divRef, false);
Expand All @@ -64,13 +68,17 @@ const useRenderIframe = (divRef: React.RefObject<HTMLDivElement | null>, headles
);
};

export const FogbenderFloatingWidget: React.FC<{
type FloatyWidgetProps = {
verbose?: boolean;
openInNewTab?: boolean;
closeable?: boolean;
defaultOpen?: boolean;
}> = ({ verbose, openInNewTab, closeable, defaultOpen }) => {
useCreateFloatingWidget({ verbose, openInNewTab, closeable, defaultOpen });
};

// old name; new name is FogbenderFloatyWidget
export const FogbenderFloatingWidget = (props: FloatyWidgetProps) => {
useCreateFloatingWidget(props);

return null;
};

Expand All @@ -79,12 +87,7 @@ const useCreateFloatingWidget = ({
openInNewTab,
closeable,
defaultOpen,
}: {
verbose?: boolean;
openInNewTab?: boolean;
closeable?: boolean;
defaultOpen?: boolean;
}) => {
}: FloatyWidgetProps) => {
const fogbender = useFogbender();
useRenderComponent(
React.useCallback(() => {
Expand Down Expand Up @@ -147,13 +150,22 @@ function addVersion(token: Token | undefined) {
return token;
}

export const FogbenderSimpleFloatie: React.FC<{
type SimpleFloatyWidgetProps = {
token: Token;
clientUrl?: string | undefined;
verbose?: boolean;
openInNewTab?: boolean;
closeable?: boolean;
}> = ({ token, clientUrl, openInNewTab, verbose, closeable }) => {
};

// old name; new name is FogbenderSimpleFloatyWidget
export const FogbenderSimpleFloatie = ({
token,
clientUrl,
openInNewTab,
verbose,
closeable,
}: SimpleFloatyWidgetProps) => {
const fogbender = React.useMemo(createNewFogbender, []);
return (
<FogbenderProvider fogbender={fogbender}>
Expand All @@ -169,3 +181,8 @@ export const FogbenderSimpleFloatie: React.FC<{
</FogbenderProvider>
);
};

export const FogbenderRoomyWidget = FogbenderWidget;
export const FogbenderSimpleRoomyWidget = FogbenderSimpleWidget;
export const FogbenderFloatyWidget = FogbenderFloatingWidget;
export const FogbenderSimpleFloatyWidget = FogbenderSimpleFloatie;
Loading