Skip to content

Commit 5808fa1

Browse files
stepper component typography styles (#542)
* stepper component typography styles * stepper component typography styles * stepper component typography styles * Move typography to the top Co-authored-by: Brian Luerssen <[email protected]> Co-authored-by: Brian Luerssen <[email protected]>
1 parent 016bd1a commit 5808fa1

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

example/src/StepperExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function StepperExample({ theme }) {
3737
onChange={(v) => setValue3(v)}
3838
min={0}
3939
max={10}
40+
style={{fontSize: 24, color: theme.colors.primary}}
4041
/>
4142
</Section>
4243
</Container>

packages/core/src/components/Stepper.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { withTheme } from "../theming";
66
import type { Theme } from "../styles/DefaultTheme";
77
import type { IconSlot } from "../interfaces/Icon";
88
import IconButton from "./IconButton";
9+
import { extractStyles } from "../utilities";
910

1011
type Props = {
1112
min: number;
1213
max: number;
1314
value?: number;
1415
defaultValue?: number;
15-
style?: StyleProp<ViewStyle>;
16-
typeStyle?: StyleProp<TextStyle>;
16+
style?: StyleProp<ViewStyle | TextStyle>;
1717
iconSize: number;
1818
iconColor?: string;
1919
onChange?: (value: number) => void;
@@ -26,13 +26,13 @@ const Stepper: FC<Props> = ({
2626
value: valueProp,
2727
defaultValue,
2828
style,
29-
typeStyle,
3029
iconSize = 24,
3130
iconColor,
3231
onChange,
3332
theme: { colors, typography },
3433
Icon,
3534
}) => {
35+
const { viewStyles, textStyles } = extractStyles(style);
3636
const [value, setValue] = useState(defaultValue ?? 0);
3737

3838
const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;
@@ -59,7 +59,7 @@ const Stepper: FC<Props> = ({
5959
}, [valueProp]);
6060

6161
return (
62-
<View style={[{ flexDirection: "row" }, style]}>
62+
<View style={[{ flexDirection: "row" }, viewStyles]}>
6363
<IconButton
6464
Icon={Icon}
6565
icon="MaterialIcons/remove"
@@ -79,7 +79,7 @@ const Stepper: FC<Props> = ({
7979
color: colors.medium,
8080
marginHorizontal: 8,
8181
},
82-
typeStyle,
82+
textStyles,
8383
]}
8484
>
8585
{value}

packages/core/src/mappings/Stepper.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
createStaticNumberProp,
77
Triggers,
88
BLOCK_STYLES_SECTIONS,
9+
StylesPanelSections,
910
} from "@draftbit/types";
1011

1112
export const SEED_DATA = [
@@ -14,7 +15,10 @@ export const SEED_DATA = [
1415
tag: "Stepper",
1516
description: "A component used to control the quantity of something",
1617
category: COMPONENT_TYPES.control,
17-
stylesPanelSections: BLOCK_STYLES_SECTIONS,
18+
stylesPanelSections: [
19+
StylesPanelSections.Typography,
20+
...BLOCK_STYLES_SECTIONS,
21+
],
1822
layout: {},
1923
triggers: [Triggers.OnChange],
2024
props: {

0 commit comments

Comments
 (0)