Skip to content

Commit

Permalink
Merge branch '5.x' into IOAPPX-459-add-new-icons-appearance-page
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnplb authored Jan 8, 2025
2 parents 166d676 + 71b6acf commit 9767996
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 75 deletions.
59 changes: 0 additions & 59 deletions example/src/pages/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,55 +194,6 @@ export const DSAlert = () => {

<VSpacer size={40} />

<H3 color={"bluegrey"} style={{ marginBottom: 16 }}>
Title + Content
</H3>

<Alert
ref={viewRef}
variant="error"
title="Alert title"
content="Ut enim ad minim veniam, quis ullamco laboris nisi ut aliquid"
/>

<VSpacer />

<Alert
ref={viewRef}
variant="warning"
title="Alert title"
content="Ut enim ad minim veniam, quis ullamco laboris nisi ut aliquid"
/>

<VSpacer />

<Alert
ref={viewRef}
variant="info"
title="Alert title"
content="Ut enim ad minim veniam, quis ullamco laboris nisi ut aliquid"
/>

<VSpacer />

<Alert
ref={viewRef}
variant="success"
title="Alert title"
content="Ut enim ad minim veniam, quis ullamco laboris nisi ut aliquid"
/>

<VSpacer />

<Alert
ref={viewRef}
variant="info"
title="A very very very looooooooooong title"
content="Ut enim ad minim veniam, quis ullamco laboris nisi ut aliquid"
/>

<VSpacer size={40} />

<H2 color={"bluegrey"} style={{ marginBottom: 16 }}>
Content + Action
</H2>
Expand Down Expand Up @@ -336,16 +287,6 @@ export const DSAlert = () => {

<VSpacer />

<Alert
fullWidth
ref={viewRef}
variant="info"
title="Alert title"
content="Ut enim ad minim veniam, quis ullamco labo nisi ut aliquid ad minim veniam"
/>

<VSpacer />

<Alert
fullWidth
ref={viewRef}
Expand Down
12 changes: 4 additions & 8 deletions src/components/alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ import { WithTestID } from "../../utils/types";
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
import { HStack, VStack } from "../stack";
import { Body, ButtonText } from "../typography";
import { H4 } from "../typography/H4";

const ICON_SIZE: IOIconSizeScale = 24;

const [padding, paddingFullWidth] = IOAlertSpacing;

type AlertProps = WithTestID<{
variant: "error" | "warning" | "info" | "success";
title?: string;
content: string;
fullWidth?: boolean;
accessibilityLabel?: string;
Expand Down Expand Up @@ -111,7 +109,6 @@ export const Alert = forwardRef<View, AlertType>(
(
{
variant,
title,
content,
action,
onPress,
Expand Down Expand Up @@ -165,15 +162,14 @@ export const Alert = forwardRef<View, AlertType>(
Tested on both Android and iOS. */}
<View
style={[
!title && isMultiline && { marginTop: -6 * dynamicFontScale },
isMultiline && { marginBottom: -4 * dynamicFontScale },
isMultiline && {
marginTop: -6 * dynamicFontScale,
marginBottom: -4 * dynamicFontScale
},
{ flex: 1 }
]}
>
<VStack space={8} allowScaleSpacing>
{title && (
<H4 color={mapVariantStates[variant].foreground}>{title}</H4>
)}
<Body
color={mapVariantStates[variant].foreground}
weight={"Regular"}
Expand Down
10 changes: 2 additions & 8 deletions stories/components/alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ const meta = {
layout: "centered"
},
argTypes: {
title: {
control: { type: "text" }
},
content: {
control: { type: "text" }
},
Expand All @@ -28,15 +25,12 @@ const meta = {
}
},
args: {
title: "Alert Title",
content: "Alert content"
},
render: args => {
const { title, content, variant } = args;
const { content, variant } = args;
const viewRef = React.createRef<View>();
return (
<Alert content={content} title={title} ref={viewRef} variant={variant} />
);
return <Alert content={content} ref={viewRef} variant={variant} />;
}
} satisfies Meta<typeof Alert>;

Expand Down

0 comments on commit 9767996

Please sign in to comment.