-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from manolakis/feat/add_back_button
Feat/add back button
- Loading branch information
Showing
19 changed files
with
182 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@pokeapp/app': minor | ||
--- | ||
|
||
add back button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@pokeapp/feat-list-pokemons': patch | ||
--- | ||
|
||
fix keyboard navigation with Pokemon Card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export default { | ||
title: 'PokeApp', | ||
search: 'search', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export default { | ||
title: 'PokeApp', | ||
search: 'buscar', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
packages/application/src/components/PokeAppPokemonDetails.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { LitElement, ScopedElementsMixin, LocalizeMixin, html, ChiButton } from 'chi-wc'; | ||
import { FeatPokemonDetails } from '@pokeapp/feat-pokemon-details'; | ||
import { NavigateToPokemonSearchEvent } from '../events/NavigateToPokemonSearchEvent.js'; | ||
import { pokeAppPokemonDetailsStyle } from './PokeAppPokemonDetails.style.js'; | ||
import { namespace } from '../namespace.js'; | ||
|
||
export class PokeAppPokemonDetails extends ScopedElementsMixin(LocalizeMixin(LitElement)) { | ||
/** @override */ | ||
static get styles() { | ||
return [super.styles || [], pokeAppPokemonDetailsStyle]; | ||
} | ||
|
||
/** @override */ | ||
static get scopedElements() { | ||
return { | ||
'chi-button': ChiButton, | ||
'feat-pokemon-details': FeatPokemonDetails, | ||
}; | ||
} | ||
|
||
/** @override */ | ||
static get properties() { | ||
return { | ||
location: { type: Object }, | ||
}; | ||
} | ||
|
||
/** @override */ | ||
static get localizeNamespaces() { | ||
return [ | ||
...super.localizeNamespaces, | ||
{ | ||
[namespace]: locale => { | ||
switch (locale) { | ||
case 'es-ES': | ||
return import('../../assets/translations/es-ES.js'); | ||
default: | ||
return import('../../assets/translations/en-GB.js'); | ||
} | ||
}, | ||
}, | ||
]; | ||
} | ||
|
||
/** | ||
* Handles the click to go to search. | ||
* @private | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this | ||
_handleGoToSearchClicked() { | ||
this.dispatchEvent(new NavigateToPokemonSearchEvent()); | ||
} | ||
|
||
/** @override */ | ||
render() { | ||
const { | ||
params: { name }, | ||
} = this.location; | ||
|
||
return html` | ||
<div class="header"> | ||
<chi-button | ||
class="search-button" | ||
data-testid="search-button" | ||
@click="${() => this._handleGoToSearchClicked()}" | ||
>< ${this.msgLit(`${namespace}:search`)}</chi-button | ||
> | ||
</div> | ||
<feat-pokemon-details data-testid="feature" name="${name}"></feat-pokemon-details> | ||
`; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/application/src/components/PokeAppPokemonDetails.style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { css } from 'chi-wc'; | ||
import { boxSizingStyle } from '@pokeapp/common'; | ||
|
||
// language=CSS | ||
export const pokeAppPokemonDetailsStyle = [ | ||
boxSizingStyle, | ||
css` | ||
.header { | ||
background-color: #263238; | ||
margin: -0.5rem -0.5rem 0.5rem; | ||
padding: 0.5rem; | ||
} | ||
`, | ||
]; |
27 changes: 0 additions & 27 deletions
27
packages/application/src/components/PokeAppPokemonsDetails.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { PokeAppPokemonDetails } from './PokeAppPokemonsDetails.js'; | ||
import { PokeAppPokemonDetails } from './PokeAppPokemonDetails.js'; | ||
|
||
customElements.define('pokeapp-pokemon-details', PokeAppPokemonDetails); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/application/src/events/NavigateToPokemonSearchEvent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { NavigationEvent } from './NavigationEvent.js'; | ||
|
||
export class NavigateToPokemonSearchEvent extends NavigationEvent { | ||
/** | ||
* Creates a NavigateToPokemonSearchEvent instance. | ||
*/ | ||
constructor() { | ||
super('pokeapp-list-pokemons'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/** i18n namespace */ | ||
export const namespace = 'pokeapp'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters