Skip to content

Commit

Permalink
Allowed FontSize props for checkbox and radio components (#318)
Browse files Browse the repository at this point in the history
* Allowed FontSize prop for checkbox and radio components

* 3.2.24
  • Loading branch information
abottega authored Aug 9, 2024
1 parent e738a2a commit 3a99495
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
5 changes: 3 additions & 2 deletions lib/components/Checkbox/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef } from "react";
import PropTypes from "prop-types";
import styled, { keyframes, ThemeProvider } from "styled-components";
import { space, layout } from "styled-system";
import { space, layout, typography } from "styled-system";
import { themeGet } from "@styled-system/theme-get";

/* Animations */
Expand Down Expand Up @@ -272,6 +272,7 @@ const Check = styled.div`
const Text = styled.div`
font-size: ${(props) => themeGet("fontSizes.2")(props)};
padding-left: 8px;
${typography}
`;
/**
* The default checkbox (or inverted if on dark background) should be used for the majority of the UI; however, the coloured ones can be used in situations where the colour corresponds with some indication of status, e.g. in a task list, green could denote task completed, red could denote task overdue.
Expand Down Expand Up @@ -325,7 +326,7 @@ export default function Checkbox({
<Box colour={colour} onClick={onClick}>
<Check />
</Box>
<Text>{label}</Text>
<Text {...props}>{label}</Text>
</Label>
</Item>
);
Expand Down
18 changes: 10 additions & 8 deletions lib/components/RadioButton/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import styled, { ThemeProvider } from "styled-components";
import { space, layout, compose, variant } from "styled-system";
import { space, layout, compose, variant, typography } from "styled-system";
import { css } from "@styled-system/css";
import { themeGet } from "@styled-system/theme-get";

Expand Down Expand Up @@ -177,12 +177,14 @@ const RadioButtonDot = styled("div")(
})
);

const RadioButtonText = styled("div")((props) =>
css({
paddingLeft: "s",
fontSize: themeGet("fontSizes.2")(props),
fontWeight: themeGet("fontWeights.1")(props)
})
const RadioButtonText = styled("div")(
(props) =>
css({
paddingLeft: "s",
fontSize: themeGet("fontSizes.2")(props),
fontWeight: themeGet("fontWeights.1")(props)
}),
typography
);

export default function RadioButton({
Expand Down Expand Up @@ -212,7 +214,7 @@ export default function RadioButton({
<RadioButtonCircle variant={variant}>
<RadioButtonDot variant={variant} />
</RadioButtonCircle>
<RadioButtonText>{label}</RadioButtonText>
<RadioButtonText {...props}>{label}</RadioButtonText>
</RadioButtonLabel>
</RadioButtonItem>
);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orcs-design-system",
"version": "3.2.23",
"version": "3.2.24",
"engines": {
"node": "20.12.2"
},
Expand Down

0 comments on commit 3a99495

Please sign in to comment.