Skip to content

Commit

Permalink
chore: update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
slavenai committed Sep 20, 2024
1 parent e6991fa commit 09c3bcc
Show file tree
Hide file tree
Showing 41 changed files with 450,460 additions and 16 deletions.
45 changes: 38 additions & 7 deletions examples-standalone/coffee-warehouse/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isPresent } from "@progress/kendo-angular-common";

@Component({
selector: "app-root",
templateUrl: "./app.component.html",
templateUrl: "./app.component.html"
})
export class AppComponent implements AfterViewInit {
public selected = "Team";
Expand All @@ -23,6 +23,12 @@ export class AppComponent implements AfterViewInit {
@HostBinding('style.--kendo-letter-spacing-normal')
public letterSpacing = '0px';

@HostBinding('style.--kendo-font-family')
public fontFamily = `'Roboto', sans-serif`;

@HostBinding('style.--text-decoration')
public textDecoration = 'none';

private themeLinkElement: HTMLLinkElement;

public ngAfterViewInit(): void {
Expand All @@ -36,11 +42,26 @@ export class AppComponent implements AfterViewInit {
this.settingsService.changes.subscribe(settings => {
console.log(settings);
for (let setting in settings) {
if (setting === 'fontSize' || setting === 'lineHeight' || setting === 'letterSpacing') {
this[setting] = `${settings[setting]}px`;
} else if (setting === 'colorTheme' && isPresent(this.themeLinkElement)) {
const newThemeLink = this.getThemeLink(settings[setting]);
this.themeLinkElement.href = newThemeLink;
switch (setting) {
case 'fontSize':
case 'letterSpacing':
this[setting] = `${settings[setting]}px`;
break;
case 'lineHeight':
this[setting] = `${settings[setting]}em`;
break;
case 'colorTheme':
if (isPresent(this.themeLinkElement)) {
const newThemeLink = this.getThemeLink(settings[setting]);
this.themeLinkElement.href = newThemeLink;
}
break;
case 'fontFamily':
this.fontFamily = this.getFontFamily(settings[setting]);
break;
case 'underlineLinks':
this.textDecoration = settings[setting] ? 'underline' : 'none';
break;
}
}
});
Expand All @@ -51,10 +72,20 @@ export class AppComponent implements AfterViewInit {
case 'contrast':
return 'https://kendo.cdn.telerik.com/themes/8.2.1/default/default-ocean-blue.css';
case 'dark':
return 'https://kendo.cdn.telerik.com/themes/8.2.1/bootstrap/bootstrap-main-dark.css';
return 'https://kendo.cdn.telerik.com/themes/8.2.1/material/material-main-dark.css';
default:
return 'https://kendo.cdn.telerik.com/themes/8.2.1/default/default-turquoise.css';
}
}

private getFontFamily(fontKey: string): string {
switch(fontKey) {
case 'legible':
return `'Verdana', sans-serif`;
case 'dyslexia':
return `OpenDyslexic`;
default:
return `''Roboto', sans-serif'`;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<kendo-formfield>
<kendo-label text="Font:"></kendo-label>
<kendo-buttongroup selection="single" width="100%">
<button kendoButton [svgIcon]="fontIcon" size="large" (click)="settingChange({'font': getSetting('font') === 'legible' ? 'defaultFont' : 'legible'})" [selected]="getSetting('font') === 'legible'">Legible Font</button>
<button kendoButton [svgIcon]="dyslexiaFontIcon" size="large" (click)="settingChange({'font': getSetting('font') === 'dyslexia' ? 'defaultFont' : 'dyslexia'})" [selected]="getSetting('font') === 'dyslexia'">Dyslexia Font</button>
<button kendoButton [svgIcon]="fontIcon" size="large" (click)="settingChange({'fontFamily': getSetting('fontFamily') === 'legible' ? 'defaultFont' : 'legible'})" [selected]="getSetting('fontFamily') === 'legible'">Legible Font</button>
<button kendoButton [svgIcon]="dyslexiaFontIcon" size="large" (click)="settingChange({'fontFamily': getSetting('fontFamily') === 'dyslexia' ? 'defaultFont' : 'dyslexia'})" [selected]="getSetting('fontFamily') === 'dyslexia'">Dyslexia Font</button>
</kendo-buttongroup>
</kendo-formfield>

Expand All @@ -54,7 +54,7 @@
</kendo-formfield>

<kendo-formfield>
<button kendoButton themeColor="primary" size="large" [svgIcon]="resetIcon" class="k-w-full">Reset All Settings</button>
<button kendoButton themeColor="primary" size="large" [svgIcon]="resetIcon" class="k-w-full" (click)="resetSettings()">Reset All Settings</button>
</kendo-formfield>
</form>
</kendo-expansionpanel>
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export class SettingsListComponent {
this.settingsService.notifySettingChange(changes);
}

public resetSettings(): void {
this.settingsService.resetSettings();
}

public onValueChange(value: string) {
console.log(`combo value changed, new value: `, value);
// get settings after API call
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="wrapper">
<div class="marquee" [ngClass]="{'marquee-animate': false}">
<div class="marquee" [ngClass]="{'marquee-animate': !pauseAnimation}">
<p>
NEW: Enhance Your Developer Experience with Ready-to-Use Page Templates and Building Blocks! <a target="_blank" href="https://www.telerik.com/page-templates-and-ui-blocks">Learn more...</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component, EventEmitter, Inject, Input, LOCALE_ID, Output, QueryList, ViewChildren } from '@angular/core';
import { Component, EventEmitter, HostBinding, Inject, Input, LOCALE_ID, Output, QueryList, ViewChildren } from '@angular/core';
import { CldrIntlService, IntlService } from '@progress/kendo-angular-intl';
import { MessageService } from '@progress/kendo-angular-l10n';
import { CustomMessagesService } from '../services/custom-messages.service';
import { SVGIcon, menuIcon, paletteIcon } from '@progress/kendo-svg-icons';
import { locales } from '../resources/locales';
import { NavigationStart, Router } from '@angular/router';
import { ButtonDirective } from '@progress/kendo-angular-buttons';
import { SettingsService } from '../settings.service';

@Component({
selector: 'app-header-component',
Expand All @@ -22,6 +23,7 @@ export class HeaderComponent {
public menuIcon: SVGIcon = menuIcon;
public paletteIcon: SVGIcon = paletteIcon;
public customMsgService: CustomMessagesService;
public pauseAnimation = false;

public selectedLanguage = { locale: 'English', localeId: 'en-US' };
public locales = locales;
Expand All @@ -42,12 +44,22 @@ export class HeaderComponent {
];
public selectedTheme = this.themes[0];

constructor(public messages: MessageService, @Inject(LOCALE_ID) public localeId: string, public intlService: IntlService, private router: Router) {
constructor(
public messages: MessageService,
@Inject(LOCALE_ID) public localeId: string,
public intlService: IntlService,
private router: Router,
private settingsService: SettingsService
) {
this.localeId = this.selectedLanguage.localeId;
this.setLocale(this.localeId);

this.customMsgService = this.messages as CustomMessagesService;
this.customMsgService.language = this.selectedLanguage.localeId;

this.settingsService.changes.subscribe(settings => {
this.pauseAnimation = settings.pauseAnimations;
});
}

ngAfterViewInit() {
Expand Down
21 changes: 18 additions & 3 deletions examples-standalone/coffee-warehouse/src/app/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {
} from '@angular/core';
import { BehaviorSubject } from 'rxjs';

const defaultFont = 'defaultFont';
const defaultTheme = 'defaultTheme';
const defaultFont = `'Roboto', sans-serif`;
const defaultTheme = 'https://kendo.cdn.telerik.com/themes/8.2.1/default/default-turquoise.css';

@Injectable()
export class SettingsService {
private _settings = {
fontSize: 16,
colorTheme: defaultTheme,
font: defaultFont,
fontFamily: defaultFont,
underlineLinks: false,
pauseAnimations: false,
lgSizeWidgets: false,
Expand All @@ -32,4 +32,19 @@ export class SettingsService {

this.changes.next(this.settings);
}

public resetSettings(): void {
this._settings = {
fontSize: 16,
colorTheme: defaultTheme,
fontFamily: defaultFont,
underlineLinks: false,
pauseAnimations: false,
lgSizeWidgets: false,
lineHeight: 1.2,
letterSpacing: 0
}

this.changes.next(this.settings);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: opendyslexic
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://gum.co/OpenDyslexic
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
release-builds
*.zip
*.sh
actions/build-regular.scpt
build-release.ps1
compiled/fonttest.html
Loading

0 comments on commit 09c3bcc

Please sign in to comment.