Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(client): language select #183

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/blog/src/assets/icons/translate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 54 additions & 21 deletions libs/blog/layouts/ui-layouts/src/lib/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,60 @@

<div class="flex flex-row items-center">
<al-navigation class="hidden lg:block" />
<div class="ml-6">
<button
class="border-al-gray-200 mr-2 rounded border bg-transparent px-4 py-2 font-medium leading-4"
[ngClass]="{
'!text-white': language() === 'en',
'!text-al-gray-50 opacity-50': language() !== 'en'
}"
(click)="languageChange.emit('en')"
>
ENG
</button>
<button
class="border-al-gray-200 mr-2 rounded border bg-transparent px-4 py-2 font-medium leading-4"
[ngClass]="{
'!text-white': language() === 'pl',
'!text-al-gray-50 opacity-50': language() !== 'pl'
}"
(click)="languageChange.emit('pl')"
>
PL
</button>
<div class="ml-6 mr-6">
<!-- <al-icon name="translate" class="bg-al-primary block h-6" />-->

<div class="flex h-full items-center">
<label
class="relative block text-gray-400 focus-within:text-gray-600"
for="language"
>
<span class="sr-only">Select language</span>
<al-icon
name="translate"
class="bg-al-primary pointer-events-none absolute left-3 top-1/2 block h-5 -translate-y-1/2 transform"
/>

<!-- <MailIcon className="pointer-events-none w-8 h-8 absolute top-1/2 transform -translate-y-1/2 left-3" />-->

<!-- <input type="email" name="email" id="email" placeholder="email@kemuscorp.com" className="form-input w-full">-->
<select
id="language"
#selectLang
class="bg-al-background w-full rounded-md py-1 pl-8"
(change)="languageChange.emit(selectLang.value)"
>
@for (lang of availableLangs; track $index) {
<option
[selected]="lang.value === language()"
[value]="lang.value"
>
{{ lang.display }}
</option>
}
</select>
</label>
</div>
<!-- <button-->
<!-- class="border-al-gray-200 mr-2 rounded border bg-transparent px-4 py-2 font-medium leading-4"-->
<!-- [ngClass]="{-->
<!-- '!text-white': language() === 'en',-->
<!-- '!text-al-gray-50 opacity-50': language() !== 'en'-->
<!-- }"-->
<!-- (click)="languageChange.emit('en')"-->
<!-- >-->
<!-- ENG-->
<!-- </button>-->
<!-- <button-->
<!-- class="border-al-gray-200 mr-2 rounded border bg-transparent px-4 py-2 font-medium leading-4"-->
<!-- [ngClass]="{-->
<!-- '!text-white': language() === 'pl',-->
<!-- '!text-al-gray-50 opacity-50': language() !== 'pl'-->
<!-- }"-->
<!-- (click)="languageChange.emit('pl')"-->
<!-- >-->
<!-- PL-->
<!-- </button>-->
</div>

<ng-content />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export class HeaderComponent {

readonly logoSize = '40';

readonly availableLangs = [
{ value: 'pl', display: 'Polish' },
{ value: 'en', display: 'English' },
];

toggleNav(): void {
this.showNav.set(!this.showNav());
}
Expand Down
1 change: 1 addition & 0 deletions libs/blog/shared/ui-icon/src/lib/icon/icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type IconType =
| 'tick'
| 'twitter-x'
| 'github-mark'
| 'translate'
| 'youtube';

@Component({
Expand Down