Skip to content

Commit 27c97f5

Browse files
Signup: Use new search for domains signup (#51718)
* Render children into the search area * Signup: Use new search for domains signup * Update e2e test selectors for the new component * Fix focused and other styles and style-lint errors * Use correct prop for default value * Move dependency to external * Fix focus styles for button
1 parent 30107c0 commit 27c97f5

File tree

6 files changed

+29
-18
lines changed

6 files changed

+29
-18
lines changed

client/components/domains/register-domain-step/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { stringify } from 'qs';
2626
import { connect } from 'react-redux';
2727
import { localize } from 'i18n-calypso';
2828
import { withShoppingCart } from '@automattic/shopping-cart';
29+
import Search from '@automattic/search';
2930

3031
/**
3132
* Internal dependencies
@@ -44,7 +45,6 @@ import {
4445
} from 'calypso/lib/domains';
4546
import { domainAvailability } from 'calypso/lib/domains/constants';
4647
import { getAvailabilityNotice } from 'calypso/lib/domains/registration/availability-messages';
47-
import Search from 'calypso/components/search';
4848
import DomainRegistrationSuggestion from 'calypso/components/domains/domain-registration-suggestion';
4949
import DomainTransferSuggestion from 'calypso/components/domains/domain-transfer-suggestion';
5050
import DomainSkipSuggestion from 'calypso/components/domains/domain-skip-suggestion';
@@ -445,13 +445,13 @@ class RegisterDomainStep extends React.Component {
445445
<StickyPanel className={ searchBoxClassName }>
446446
<CompactCard className="register-domain-step__search-card">
447447
<Search
448-
additionalClasses={ this.state.clickedExampleSuggestion ? 'is-refocused' : undefined }
448+
className={ this.state.clickedExampleSuggestion ? 'is-refocused' : undefined }
449449
autoFocus // eslint-disable-line jsx-a11y/no-autofocus
450450
delaySearch={ true }
451451
delayTimeout={ 1000 }
452452
describedBy={ 'step-header' }
453453
dir="ltr"
454-
initialValue={ this.state.lastQuery }
454+
defaultValue={ this.state.lastQuery }
455455
value={ this.state.lastQuery }
456456
inputLabel={ this.props.translate( 'What would you like your domain name to be?' ) }
457457
minLength={ MIN_QUERY_LENGTH }

client/signup/steps/domains/style.scss

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
margin-bottom: 20px;
1414
}
1515

16-
.search .search__icon-navigation {
16+
.search-component .search-component__icon-navigation {
1717
background: none;
1818
}
1919

@@ -22,14 +22,14 @@
2222
@include elevation( 2dp );
2323
}
2424

25-
.search.is-open.has-focus {
25+
.search-component.is-open.has-focus {
2626
border: none;
2727
border-radius: 2px;
2828
box-shadow: 0 0 0 3px var( --color-accent-light );
2929
}
3030

3131
.search-filters__dropdown-filters {
32-
border-radius: 0 3px 3px 0;
32+
border-radius: 0 2px 2px 0;
3333
}
3434

3535
.search-filters__dropdown-filters.search-filters__dropdown-filters--is-open {
@@ -38,7 +38,7 @@
3838

3939
@include breakpoint-deprecated( '<660px' ) {
4040
.register-domain-step__search-card,
41-
.search.is-open.has-focus {
41+
.search-component.is-open.has-focus {
4242
border-radius: 0;
4343
}
4444
}
@@ -56,10 +56,10 @@ body.is-section-signup.is-white-signup {
5656
}
5757

5858
.domains__step-content {
59-
.search.is-open.has-focus {
59+
.search-component.is-open.has-focus {
6060
box-shadow: 0 0 0 2px var( --color-accent );
6161
background: var( --color-surface );
62-
.search__input {
62+
.search-component__input {
6363
background: var( --color-surface );
6464
}
6565
}
@@ -73,19 +73,19 @@ body.is-section-signup.is-white-signup {
7373
margin: initial;
7474
}
7575
}
76-
.search__input {
76+
.search-component__input {
7777
background: $light-white;
7878
&::placeholder {
7979
color: var( --color-neutral-100 );
8080
}
8181
}
82-
.search.is-open .search__input-fade.ltr::before {
82+
.search-component.is-open .search-component__input-fade.ltr::before {
8383
display: none;
8484
}
85-
.search__open-icon {
85+
.search-component__open-icon {
8686
transform: scaleX( -1 );
8787
}
88-
.search__close-icon {
88+
.search-component__close-icon {
8989
display: none;
9090
}
9191
}

desktop/e2e/tests/lib/pages/signup-steps-page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SignupStepsPage extends AsyncBaseContainer {
3838
}
3939

4040
async selectDomain( domainName ) {
41-
const searchDomainField = By.css( '.search__input' );
41+
const searchDomainField = By.css( '.search-component__input' );
4242

4343
await driverHelper.waitTillPresentAndDisplayed(
4444
this.driver,

packages/search/src/search.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
import { useI18n } from '@wordpress/react-i18n';
77
import classNames from 'classnames';
88
import React, { useEffect } from 'react';
9-
import type { Ref, ChangeEvent, FocusEvent, FormEvent, KeyboardEvent, MouseEvent } from 'react';
9+
import type {
10+
ReactNode,
11+
Ref,
12+
ChangeEvent,
13+
FocusEvent,
14+
FormEvent,
15+
KeyboardEvent,
16+
MouseEvent,
17+
} from 'react';
1018
import { debounce } from 'lodash';
1119

1220
/**
@@ -50,6 +58,7 @@ type Props = {
5058
autoFocus?: boolean;
5159
className?: string;
5260
compact?: boolean;
61+
children?: ReactNode;
5362
defaultIsOpen?: boolean;
5463
defaultValue?: string;
5564
delaySearch?: boolean;
@@ -111,6 +120,7 @@ type ImperativeHandle = {
111120

112121
const InnerSearch = (
113122
{
123+
children,
114124
delaySearch = false,
115125
disabled = false,
116126
pinned = false,
@@ -428,6 +438,7 @@ const InnerSearch = (
428438
{ renderStylingDiv() }
429439
</form>
430440
{ shouldRenderRightOpenIcon ? renderOpenIcon() : renderCloseButton() }
441+
{ children }
431442
</div>
432443
);
433444
};

packages/search/src/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ $input-z-index: 20;
170170

171171
.components-button {
172172
padding: 0;
173-
173+
174174
&:focus {
175-
box-shadow: none;
175+
z-index: 9999;
176176
}
177177
}
178178

test/e2e/lib/components/find-a-domain-component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import AsyncBaseContainer from '../async-base-container';
1010
import * as slackNotifier from '../slack-notifier';
1111
import * as driverHelper from '../driver-helper.js';
1212

13-
const searchInputSelector = By.className( 'search__input' );
13+
const searchInputSelector = By.className( 'search-component__input' );
1414

1515
export default class FindADomainComponent extends AsyncBaseContainer {
1616
constructor( driver ) {

0 commit comments

Comments
 (0)