Skip to content

Commit

Permalink
liveDestination props
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Mar 7, 2025
1 parent b53a95f commit 9ae15e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion website/src/components/organisms/liveCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState, useRef, memo } from 'react';
import { debounce } from '@elbwalker/utils';
import CodeBox, { formatValue } from '../molecules/codeBox';

interface LiveCodeProps {
export interface LiveCodeProps {
input: string;
config?: string;
output?: string;
Expand Down
24 changes: 5 additions & 19 deletions website/src/components/organisms/liveDestination.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Destination, Mapping, WalkerOS } from '@elbwalker/types';
import type { DestinationWeb } from '@elbwalker/walker.js';
import type { LiveCodeProps } from './liveCode';
import React, {
createContext,
useCallback,
Expand Down Expand Up @@ -96,28 +97,18 @@ export const DestinationInit: React.FC<DestinationInitProps> = ({
);
};

interface DestinationPushProps {
interface DestinationPushProps
extends Omit<LiveCodeProps, 'input' | 'config' | 'fn' | 'options'> {
event: WalkerOS.PartialEvent;
mapping?: Mapping.EventConfig | string;
height?: number;
smallText?: boolean;
className?: string;
labelLeft?: string;
labelMiddle?: string;
labelRight?: string;
eventConfig?: boolean;
}

export const DestinationPush: React.FC<DestinationPushProps> = ({
event,
mapping = {},
height,
smallText,
className,
labelLeft,
labelMiddle = 'Event Config',
labelRight,
eventConfig = true,
...liveCodeProps
}) => {
const { customConfig, destination, fnName } = useDestinationContext();
const inputValue = formatValue(event);
Expand Down Expand Up @@ -165,12 +156,7 @@ export const DestinationPush: React.FC<DestinationPushProps> = ({
config={mappingValue}
fn={mappingFn}
options={customConfig}
height={height}
smallText={smallText}
className={className}
labelInput={labelLeft}
labelConfig={labelMiddle}
labelOutput={labelRight}
{...liveCodeProps}
/>
);
};
Expand Down

0 comments on commit 9ae15e5

Please sign in to comment.