Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/cuddly-carpets-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@equinor/mad-core": patch
---

the "Remove" button on the service message now works again
5 changes: 5 additions & 0 deletions .changeset/empty-crews-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@equinor/mad-components": minor
---

`CellSwipeItem` is no longer exported from the library
3 changes: 1 addition & 2 deletions packages/components/src/components/Cell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Cell as _Cell, CellProps } from "./Cell";
import { CellSwipeItemProps } from "./types";
import { ButtonCell, ButtonCellProps } from "./ButtonCell";
import { SwitchCell, SwitchCellProps } from "./SwitchCell";
import { CellSwipeItem } from "./CellSwipeItem";

type CellFamily = typeof _Cell & {
/**
Expand All @@ -29,7 +28,7 @@ Cell.Navigation = NavigationCell;
Cell.Button = ButtonCell;
Cell.Switch = SwitchCell;

export { Cell, CellSwipeItem };
export { Cell };
export type {
CellProps,
CellGroupProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
PressableHighlight,
Typography,
useStyles,
CellSwipeItem,
} from "@equinor/mad-components";
import { ExpansionToggle } from "./components/ExpansionToggle";
import { DisableableSwipeable } from "./components/DisableableSwipeable";
import { useServiceMessageState } from "./ServiceMessageProvider";
import { resolveMessageFromServiceMessage } from "./utils/resolveMessageFromServiceMessage";
import { SwipeItem } from "./components/SwipeItem";

export const ServiceMessageBanner = () => {
const styles = useStyles(theme);
Expand All @@ -37,7 +37,7 @@ export const ServiceMessageBanner = () => {
<DisableableSwipeable
disabled={!dismissAndURLIsVisible}
renderRightActions={() => (
<CellSwipeItem
<SwipeItem
title="Remove"
iconName="close"
color="danger"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { EDSColor, EDSStyleSheet, Icon, IconName, PressableHighlight, Typography, useStyles } from "@equinor/mad-components";
import React from "react";

type SwipeItemProps = {
title: string,
iconName: IconName,
color: EDSColor,
onPress: () => void
}

export const SwipeItem = ({
title,
iconName,
color,
onPress,
}: SwipeItemProps) => {
const styles = useStyles(themeStyles, { color });

return (
<PressableHighlight
style={styles.container}
onPress={onPress}
>
{iconName && (
<Icon name={iconName} style={styles.textStyle} size={title ? undefined : 28} />
)}
{title && (
<Typography group="interactive" variant="button" style={styles.textStyle}>
{title}
</Typography>
)}
</PressableHighlight>
);
};

const themeStyles = EDSStyleSheet.create((theme, props: { color?: EDSColor }) => ({
container: {
flexDirection: "row",
alignItems: "center",
gap: theme.spacing.button.iconGap,
backgroundColor: props.color
? theme.colors.interactive[props.color]
: theme.colors.interactive.primary,
paddingHorizontal: theme.spacing.element.paddingHorizontal,
paddingVertical: theme.spacing.element.paddingVertical,
},
textStyle: {
color: theme.colors.text.primaryInverted,
},
}));
Loading