Skip to content

Commit

Permalink
fix: checkbox label styles for small screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa authored and sandroscosta committed Nov 6, 2024
1 parent 7e415f4 commit df89f7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"build": "make build",
"i18n_extract": "fedx-scripts formatjs extract",
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
"lint": "fedx-scripts eslint --ext .js --ext .jsx . --fix",
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
"start:with-theme": "paragon install-theme && npm start && npm install",
Expand Down
10 changes: 6 additions & 4 deletions src/components/modal-tos/ModalToS.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FormattedMessage, getLocale, injectIntl } from '@edx/frontend-platform/
import {
Button, Form, Hyperlink, ModalDialog, useToggle, useCheckboxSetValues,
ActionRow,
useWindowSize,
} from '@openedx/paragon';

import { getUserTOSPreference, updateUserTOSPreference } from './data/api';
Expand All @@ -23,7 +24,8 @@ const createTOSLink = (chunks, url) => (
const ModalToS = () => {
const [tosPreference, setTosPreference] = useState(undefined);
const [isOpen, open, close] = useToggle(false);

const { width } = useWindowSize();
const checkboxLabelStyle = (width < 768) ? 'd-inline-block' : null;
const {
MODAL_UPDATE_TERMS_OF_SERVICE,
PRIVACY_POLICY_URL,
Expand Down Expand Up @@ -108,7 +110,7 @@ const ModalToS = () => {
>
{dataAuthorization
&& (
<Form.Checkbox value="dataAuthorization">
<Form.Checkbox value="dataAuthorization" labelClassName={checkboxLabelStyle}>
<FormattedMessage
id="modalToS.dataAuthorization.checkbox.label"
description="The label for the data authorization checkbox inside the TOS modal."
Expand All @@ -121,7 +123,7 @@ const ModalToS = () => {
)}
{termsOfService
&& (
<Form.Checkbox value="termsOfService">
<Form.Checkbox value="termsOfService" labelClassName={checkboxLabelStyle}>
<FormattedMessage
id="modalToS.termsOfService.checkbox.label"
description="The label for the terms of service checkbox inside the TOS modal."
Expand All @@ -135,7 +137,7 @@ const ModalToS = () => {
)}
{honorCode
&& (
<Form.Checkbox value="honorCode">
<Form.Checkbox value="honorCode" labelClassName={checkboxLabelStyle}>
<FormattedMessage
id="modalToS.honorCode.checkbox.label"
description="The label for the honor code checkbox inside the TOS modal."
Expand Down

0 comments on commit df89f7b

Please sign in to comment.