diff --git a/demos/cypress-shared/cypress/support/commands.ts b/demos/cypress-shared/cypress/support/commands.ts index 6450bfaa69..a5a19aaf01 100644 --- a/demos/cypress-shared/cypress/support/commands.ts +++ b/demos/cypress-shared/cypress/support/commands.ts @@ -59,20 +59,19 @@ function clickIAmHuman(): Cypress.Chainable { } function captchaImages(): Cypress.Chainable> { - return ( - cy - .xpath("//p[contains(text(),'images containing')]", { timeout: 4000 }) - .should('be.visible') - .parent() - .parent() - .children() - .next() - //.next() - .children() - .first() - .children() - .as('captchaImages') - ) + return cy + .xpath("//p[contains(text(),'all containing')]", { timeout: 4000 }) + .should('be.visible') + .parent() + .parent() + .parent() + .parent() + .children() + .next() + .children() + .first() + .children() + .as('captchaImages') } function getSelectors(captcha: Captcha) { diff --git a/packages/common/src/locales/en.json b/packages/common/src/locales/en.json index 2de3f4b4a3..f7603cb334 100644 --- a/packages/common/src/locales/en.json +++ b/packages/common/src/locales/en.json @@ -3,7 +3,8 @@ "NO_POLKADOT_EXTENSION": "Polkadot extension not found" }, "WIDGET": { - "SELECT_ALL": "Select all images containing a", + "SELECT_ALL": "Select all containing the following", + "IF_NONE_CLICK_NEXT": "If there are none, click Next", "NEXT": "Next", "SUBMIT": "Submit", "CANCEL": "Cancel", diff --git a/packages/procaptcha-react/src/components/CaptchaComponent.tsx b/packages/procaptcha-react/src/components/CaptchaComponent.tsx index 4a15a49696..80b0624e21 100644 --- a/packages/procaptcha-react/src/components/CaptchaComponent.tsx +++ b/packages/procaptcha-react/src/components/CaptchaComponent.tsx @@ -58,6 +58,11 @@ const CaptchaComponent = ({ maxHeight: '100%', display: 'flex', flexDirection: 'column', + border: '1px solid #dddddd', + boxShadow: 'rgba(255, 255, 255, 0.2) 0px 0px 4px', + borderRadius: '4px', + padding: `${theme.spacing.unit}px`, + backgroundColor: theme.palette.background.default, }} >
-

- {t('WIDGET.SELECT_ALL')} - {': '} -

-

- {`${at(challenge.captchas, index).captcha.target}`} -

+
+

+ {t('WIDGET.SELECT_ALL')} + {':'} +   + + {`${at(challenge.captchas, index).captcha.target}`} + +

+

+ {t('WIDGET.IF_NONE_CLICK_NEXT')} +

+
+
{captcha && ( @@ -119,14 +140,14 @@ const CaptchaComponent = ({ />
{items.map((item, index) => { const hash = getHash(item) + const imageStyle: Properties = { + ...paddingForImageColumns[index % 3], + ...paddingForImageRows[Math.floor(index / 3)], + // enable the items in the grid to grow in width to use up excess space + flexGrow: 1, + // make the width of each item 1/3rd of the width overall, i.e. 3 columns + flexBasis: '33.3333%', + // include the padding / margin / border in the width + boxSizing: 'border-box', + } + console.log('imageStyle index ', index, imageStyle) return ( -
+
onClick(hash)} onTouchStart={isTouchDevice ? () => onClick(hash) : undefined} > -
+
left: '50%', transform: 'translate(-50%, -50%)', width: '400px', - backgroundColor: 'rgb(255, 255, 255)', + backgroundColor: 'transparent', border: 'none', boxShadow: 'rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px,', diff --git a/packages/web-components/src/theme.ts b/packages/web-components/src/theme.ts index eba78558f5..e2df8e3746 100644 --- a/packages/web-components/src/theme.ts +++ b/packages/web-components/src/theme.ts @@ -25,6 +25,8 @@ const grey = { 900: '#212121', } +const DEFAULT_SPACING = 10 // size in pixels + export const lightTheme = { palette: { mode: 'light', @@ -38,6 +40,10 @@ export const lightTheme = { }, grey, }, + spacing: { + unit: DEFAULT_SPACING, + half: Math.floor(DEFAULT_SPACING / 2), + }, } export const darkTheme = { @@ -53,4 +59,8 @@ export const darkTheme = { }, grey, }, + spacing: { + unit: DEFAULT_SPACING, + half: Math.floor(DEFAULT_SPACING / 2), + }, }