Skip to content

Commit

Permalink
feat(footer): support forcing omitting locale button (#4691)
Browse files Browse the repository at this point in the history
### Related Ticket(s)

Refs #4684.

### Changelog

**New**

- `disable-locale-button` attribute to `<dds-footer-composite>` and `<dds-dotcom-shell-composite>`.
  • Loading branch information
asudoh authored Dec 10, 2020
1 parent 387445f commit a765004
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ import '@carbon/ibmdotcom-web-components/es/components/dotcom-shell/dotcom-shell
</dds-dotcom-shell-container>
```

## Props

### `<dds-dotcom-shell-container>`/`<dds-dotcom-shell-composite>`

<Props of="dds-dotcom-shell-composite" />

## Stable selectors

See [our README](https://github.com/carbon-design-system/carbon-for-ibm-dotcom/tree/master/packages/web-components#stable-selectors-for-analytics-and-integratione2e-testing-in-web-components) to see how Web Components selector and `data-autoid` should be used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ class DDSDotcomShellComposite extends LitElement {
@property({ attribute: false })
currentSearchResults: string[] = [];

/**
* `true` to omit the locale switcher button.
*/
@property({ attribute: 'disable-locale-button' })
disableLocaleButton = false;

/**
* The throttle timeout to run query upon user input. This goes to masthead.
*/
Expand Down Expand Up @@ -262,6 +268,7 @@ class DDSDotcomShellComposite extends LitElement {
brandName,
collatorCountryName,
currentSearchResults,
disableLocaleButton,
mastheadAssistiveText,
menuBarAssistiveText,
menuButtonAssistiveTextActive,
Expand Down Expand Up @@ -319,6 +326,7 @@ class DDSDotcomShellComposite extends LitElement {
pickBy(
{
collatorCountryName,
disableLocaleButton,
language,
langDisplay,
legalLinks,
Expand Down
18 changes: 16 additions & 2 deletions packages/web-components/src/components/footer/footer-composite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ class DDSFooterComposite extends ModalRenderMixin(HybridRenderMixin(HostListener
@property({ attribute: false })
collatorCountryName = new Intl.Collator();

/**
* `true` to omit the locale switcher button.
*/
@property({ attribute: 'disable-locale-button' })
disableLocaleButton = false;

/**
* The language used for query.
*/
Expand Down Expand Up @@ -193,7 +199,15 @@ class DDSFooterComposite extends ModalRenderMixin(HybridRenderMixin(HostListener
}

renderLightDOM() {
const { buttonLabel, langDisplay, size, links, legalLinks, _handleClickLocaleButton: handleClickLocaleButton } = this;
const {
buttonLabel,
disableLocaleButton,
langDisplay,
size,
links,
legalLinks,
_handleClickLocaleButton: handleClickLocaleButton,
} = this;
return html`
<dds-footer size="${ifNonNull(size)}">
<dds-footer-logo></dds-footer-logo>
Expand All @@ -210,7 +224,7 @@ class DDSFooterComposite extends ModalRenderMixin(HybridRenderMixin(HostListener
`
)}
</dds-footer-nav>
${size !== FOOTER_SIZE.MICRO
${!disableLocaleButton && size !== FOOTER_SIZE.MICRO
? html`
<dds-locale-button buttonLabel="${ifNonNull(buttonLabel)}" @click="${handleClickLocaleButton}"
>${langDisplay}</dds-locale-button
Expand Down

0 comments on commit a765004

Please sign in to comment.