Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/mighty-readers-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@equinor/mad-chronicles": patch
---

Wrap buttons in button screen
10 changes: 10 additions & 0 deletions .changeset/sharp-snails-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@equinor/mad-components": patch
---

Make dialog responsive to all text sizes

- Make dialog title responsive
- Make dialog custom content scrollable
- Make action buttons wrap when necessary
- Avoid clipping of button content in dialog action buttons
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ const themeStyles = EDSStyleSheet.create(theme => ({
buttonRow: {
paddingVertical: 8,
flexDirection: "row",
flexWrap: "wrap",
justifyContent: "space-around",
gap: 12,
},
}));
2 changes: 1 addition & 1 deletion packages/components/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ const themeStyles = EDSStyleSheet.create((theme, props: ButtonStyleSheetProps) =
minHeight: theme.geometry.dimension.button.minHeight - outlinedHeightReduction,
paddingHorizontal: theme.spacing.button.paddingHorizontal - outlinedPaddingReduction,
paddingVertical: theme.spacing.button.paddingVertical - outlinedPaddingReduction,
justifyContent: "center"
},
labelContainer: {
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const themeStyles = EDSStyleSheet.create(
(theme, props: { style: StyleProp<ViewStyle>; dimensions: ScaledSize }) => ({
dialog: StyleSheet.flatten({
backgroundColor: theme.colors.container.elevation.aboveScrim,
maxHeight: "100%",
borderRadius: theme.geometry.border.elementBorderRadius,
minHeight: theme.geometry.dimension.dialog.minHeight,
width: theme.geometry.dimension.dialog.defaultWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const themeStyles = EDSStyleSheet.create((theme, align: "left" | "right") => ({
spacer: { flex: 1 },
actionsContainer: {
flexDirection: "row",
flexWrap: "wrap",
gap: theme.spacing.dialog.gap,
justifyContent: align === "left" ? "flex-start" : "flex-end",
padding: theme.spacing.dialog.padding,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React, { PropsWithChildren } from "react";
import { View } from "react-native";
import { Pressable, ScrollView } from "react-native";
import { EDSStyleSheet } from "../../styling";
import { useStyles } from "../../hooks/useStyles";

export const DialogCustomContent = ({ children }: PropsWithChildren) => {
const styles = useStyles(themeStyles);
return <View style={styles.customContentContainer}>{children}</View>;
return (
<ScrollView contentContainerStyle={styles.customContentContainer}>
<Pressable>
{children}
</Pressable>
</ScrollView>
);
};

const themeStyles = EDSStyleSheet.create(theme => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/Dialog/DialogHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const DialogHeader = (props: TextChildren) => {

const themeStyles = EDSStyleSheet.create(theme => ({
header: {
height: theme.geometry.dimension.dialog.header.height - theme.geometry.border.borderWidth,
minHeight: theme.geometry.dimension.dialog.header.height - theme.geometry.border.borderWidth,
width: "100%",
borderBottomWidth: theme.geometry.border.borderWidth,
borderBottomColor: theme.colors.border.medium,
Expand Down
13 changes: 9 additions & 4 deletions packages/components/src/components/Scrim/Scrim.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { PropsWithChildren } from "react";
import { LayoutAnimation, Pressable, StyleSheet } from "react-native";
import { LayoutAnimation, Pressable, SafeAreaView, StyleSheet } from "react-native";
import { Portal } from "../Portal";
import { EDSStyleSheet } from "../../styling";
import { useStyles } from "../../hooks/useStyles";
Expand All @@ -22,7 +22,9 @@ export const Scrim = ({ isOpen, onPress, children }: ScrimProps) => {
return (
<Portal name="scrim">
<Pressable style={styles.scrim} onPress={onPress}>
{children}
<SafeAreaView style={styles.safeAreaView}>
{children}
</SafeAreaView>
</Pressable>
</Portal>
);
Expand All @@ -31,8 +33,11 @@ export const Scrim = ({ isOpen, onPress, children }: ScrimProps) => {
const themeStyles = EDSStyleSheet.create(theme => ({
scrim: {
...StyleSheet.absoluteFillObject,
justifyContent: "center",
alignItems: "center",
backgroundColor: theme.colors.container.scrim,
},
safeAreaView: {
flex: 1,
justifyContent: "center",
alignItems: "center"
}
}));
Loading