Skip to content

Commit

Permalink
add placeholder text color variable and style customize for input ele…
Browse files Browse the repository at this point in the history
…ment #10
  • Loading branch information
ssleptsov committed Dec 10, 2021
1 parent 6537f9b commit c9a1d03
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ If you need more style control, use any of the CSS variables below.
| --ninja-actions-height | 300px; |
| --ninja-group-text-color | rgb(144, 149, 157); |
| --ninja-footer-background | rgba(242, 242, 242, 0.4); |
| --ninja-placeholder-color | #8e8e8e |


#### Example
Expand All @@ -266,6 +267,8 @@ It's supported by [all modern browsers](https://caniuse.com/mdn-css_selectors_pa
| actions-list | Element that wraps all child elements. |
| ninja-action | Single action |
| ninja-selected | Selected action |
| ninja-input | Input element |
| ninja-input-wrapper | Wrapper element around div, useful for advanced styles|

#### Example style using parts
```css
Expand All @@ -280,6 +283,19 @@ ninja-keys::part(ninja-action) {
ninja-keys::part(ninja-selected) {
background: rgba(51, 51, 51, 0.1);
}


ninja-keys::part(ninja-input) {
color: #14b8a6;
}

ninja-keys::part(ninja-input)::placeholder {
color: #f43f5e;
}

ninja-keys::part(ninja-input-wrapper) {
background: rgba(244, 63, 93, 0.3);
}
```

### Icons
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ninja-keys",
"version": "1.1.7",
"version": "1.1.8",
"description": "Ninja Keys",
"main": "dist/ninja-keys.js",
"module": "dist/ninja-keys.js",
Expand Down
2 changes: 2 additions & 0 deletions src/base-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const baseStyles = css`
--ninja-footer-background: rgba(242, 242, 242, 0.4);
--ninja-placeholder-color: #8e8e8e;
font-size: var(--ninja-font-size);
}
Expand Down
6 changes: 5 additions & 1 deletion src/ninja-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class NinjaHeader extends LitElement {
color: var(--ninja-text-color);
outline: none;
}
.search::placeholder {
color: var(--ninja-placeholder-color);
}
.breadcrumb-list {
padding: 1em 4em 0 1em;
display: flex;
Expand Down Expand Up @@ -93,8 +96,9 @@ export class NinjaHeader extends LitElement {

return html`
${breadcrumbs}
<div class="search-wrapper">
<div part="ninja-input-wrapper" class="search-wrapper">
<input
part="ninja-input"
type="text"
id="search"
spellcheck="false"
Expand Down
1 change: 1 addition & 0 deletions src/ninja-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ export class NinjaKeys extends LitElement {
<div @click=${this._overlayClick} class=${classMap(menuClasses)}>
<div class=${classMap(classes)} @animationend=${this._onTransitionEnd}>
<ninja-header
exportparts="ninja-input,ninja-input-wrapper"
${ref(this._headerRef)}
.placeholder=${this.placeholder}
.hideBreadcrumbs=${this.hideBreadcrumbs}
Expand Down

0 comments on commit c9a1d03

Please sign in to comment.