Skip to content
Open
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
30 changes: 25 additions & 5 deletions live-editing/configs/SwitchConfigGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,44 @@ export class SwitchConfigGenerator implements IConfigGenerator {
public generateConfigs(): Config[] {
const configs = new Array<Config>();

// switch sample 1
// switch overview
configs.push(new Config({
component: 'SwitchSample1Component',
component: 'SwitchOverviewComponent',
appConfig: BaseAppConfig,
shortenComponentPathBy: "/data-entries/switch/"
}));

// switch sample 2
// switch enabled
configs.push(new Config({
component: 'SwitchSample2Component',
component: 'SwitchEnabledComponent',
appConfig: BaseAppConfig,
shortenComponentPathBy: "/data-entries/switch/"
}));

// switch disabled
configs.push(new Config({
component: 'SwitchDisabledComponent',
appConfig: BaseAppConfig,
shortenComponentPathBy: "/data-entries/switch/"
}));

// switch selected
configs.push(new Config({
component: 'SwitchSelectedComponent',
appConfig: BaseAppConfig,
shortenComponentPathBy: "/data-entries/switch/"
}));

// switch layout
configs.push(new Config({
component: 'SwitchLayoutComponent',
appConfig: BaseAppConfig,
shortenComponentPathBy: "/data-entries/switch/"
}));

// switch styling
configs.push(new Config({
component: 'SwitchStylingComponent',
additionalFiles: ["/src/app/data-entries/switch/switch-styling/layout.scss"],
appConfig: BaseAppConfig,
shortenComponentPathBy: "/data-entries/switch/"
}));
Expand Down
7 changes: 5 additions & 2 deletions src/app/data-entries/data-entries-routes-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ export const dataEntriesRoutesData = {
"radio-styling-sample": { displayName: "Styling Radio Buttons", parentName: "Radio" },
"radio-tailwind-styling-sample": { displayName: "Tailwind Styling Radio Buttons", parentName: "Radio" },
"rating-form": { displayName: "Rating in Form", parentName: "Rating" },
"switch-sample-1": { displayName: "Switch Overview", parentName: "Switch" },
"switch-sample-2": { displayName: "Multiple Switches", parentName: "Switch" },
"switch-overview": { displayName: "Switch Overview", parentName: "Switch" },
"switch-enabled": { displayName: "Enabled Switches", parentName: "Switch" },
"switch-disabled": { displayName: "Disabled Switches", parentName: "Switch" },
"switch-selected": { displayName: "Selected Switches", parentName: "Switch" },
"switch-layout": { displayName: "Switch Label Position", parentName: "Switch" },
"switch-styling": { displayName: "Styled Switches", parentName: "Switch" },
"switch-tailwind-styling": { displayName: "Tailwind Styled Switches", parentName: "Switch" },
"select-sample-1": { displayName: "Simple Select", parentName: "Select" },
Expand Down
34 changes: 26 additions & 8 deletions src/app/data-entries/data-entries.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ import { SelectSample2Component } from './select/select-sample-2/select-sample-2
import { SelectSample4Component } from './select/select-sample-4/select-sample-4.component';
import { SelectStylingComponent } from './select/select-styling/select-styling.component';
import { SelectTailwindStylingComponent } from './select/select-tailwind-styling/select-tailwind-styling.component';
import { SwitchSample1Component } from './switch/switch-sample-1/switch-sample-1.component';
import { SwitchSample2Component } from './switch/switch-sample-2/switch-sample-2.component';
import { SwitchOverviewComponent } from './switch/switch-overview/switch-overview.component';
import { SwitchEnabledComponent } from './switch/switch-enabled/switch-enabled.component';
import { SwitchDisabledComponent } from './switch/switch-disabled/switch-disabled.component';
import { SwitchSelectedComponent } from './switch/switch-selected/switch-selected.component';
import { SwitchLayoutComponent } from './switch/switch-layout/switch-layout.component';
import { SwitchStylingComponent } from './switch/switch-styling/switch-styling.component';
import { SwitchTailwindStylingComponent } from './switch/switch-tailwind-styling/switch-tailwind-styling.component';
import { RatingInFormComponent } from './rating/rating-form/rating-form.component';
Expand Down Expand Up @@ -427,14 +430,29 @@ export const DataEntriesRoutes: Routes = [
path: 'rating-form'
},
{
component: SwitchSample1Component,
data: dataEntriesRoutesData['switch-sample-1'],
path: 'switch-sample-1'
component: SwitchOverviewComponent,
data: dataEntriesRoutesData['switch-overview'],
path: 'switch-overview'
},
{
component: SwitchSample2Component,
data: dataEntriesRoutesData['switch-sample-2'],
path: 'switch-sample-2'
component: SwitchEnabledComponent,
data: dataEntriesRoutesData['switch-enabled'],
path: 'switch-enabled'
},
{
component: SwitchDisabledComponent,
data: dataEntriesRoutesData['switch-disabled'],
path: 'switch-disabled'
},
{
component: SwitchSelectedComponent,
data: dataEntriesRoutesData['switch-selected'],
path: 'switch-selected'
},
{
component: SwitchLayoutComponent,
data: dataEntriesRoutesData['switch-layout'],
path: 'switch-layout'
},
{
component: SwitchStylingComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="states">
<div class="states__variant">
<span class="states__label">Disabled Checked</span>
<igx-switch labelPosition="before" [disabled]="true" [checked]="true">
<span>Power</span>
</igx-switch>
</div>
<div class="states__variant">
<span class="states__label">Disabled Unchecked</span>
<igx-switch labelPosition="before" [disabled]="true">
<span>Power</span>
</igx-switch>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@use "igniteui-angular/theming" as *;
@use "sass:map";

:host {
display: flex;
min-block-size: 100%;
box-sizing: border-box;
place-content: center;
place-items: center;
padding: 16px;

@include tokens(switch-theme($schema: map.get($light-material-schema, switch)));
}

.states {
--variant-gap: 60px;
--label-gap: 30px;

display: flex;
align-items: center;
justify-content: center;
gap: var(--variant-gap);

.states__variant {
display: flex;
align-items: center;
gap: var(--label-gap);
}

.states__label {
font: 500 14px / 24px "Aktiv Grotesk", sans-serif;
letter-spacing: 0.1px;
color: var(--ig-gray-600);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { IgxSwitchComponent } from 'igniteui-angular/switch';

@Component({
selector: 'app-switch-disabled',
styleUrls: ['./switch-disabled.component.scss'],
templateUrl: './switch-disabled.component.html',
imports: [IgxSwitchComponent]
})
export class SwitchDisabledComponent { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="states">
<span class="states__corner"></span>
<span class="states__column">Hover</span>
<span class="states__column">Focused</span>
<span class="states__column">Focused &amp; Hover</span>

<span class="states__row">Enabled / On</span>
<igx-switch labelPosition="before" [checked]="true">
<span>Power</span>
</igx-switch>
<igx-switch labelPosition="before" [checked]="true">
<span>Power</span>
</igx-switch>
<igx-switch labelPosition="before" [checked]="true">
<span>Power</span>
</igx-switch>

<span class="states__row">Enabled / Off</span>
<igx-switch labelPosition="before">
<span>Power</span>
</igx-switch>
<igx-switch labelPosition="before">
<span>Power</span>
</igx-switch>
<igx-switch labelPosition="before">
<span>Power</span>
</igx-switch>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@use "igniteui-angular/theming" as *;
@use "sass:map";

:host {
display: flex;
place-content: center;
place-items: center;
padding: 16px;

@include tokens(switch-theme($schema: map.get($light-material-schema, switch)));
}

.states {
display: grid;
grid-template-columns: repeat(4, auto);
align-items: center;
gap: 32px 24px;

.states__column,
.states__row {
font: 500 14px / 24px "Aktiv Grotesk", sans-serif;
letter-spacing: 0.1px;
color: var(--ig-gray-600);
}

.states__column {
text-align: center;
}

.states__row {
text-align: end;
}

igx-switch {
justify-self: center;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { IgxSwitchComponent } from 'igniteui-angular/switch';

@Component({
selector: 'app-switch-enabled',
styleUrls: ['./switch-enabled.component.scss'],
templateUrl: './switch-enabled.component.html',
imports: [IgxSwitchComponent]
})
export class SwitchEnabledComponent { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="variants">
<div class="variants__item">
<span class="variants__label">Label Before</span>
<igx-switch labelPosition="before" [checked]="true">
<span>Power</span>
</igx-switch>
</div>
<div class="variants__item">
<span class="variants__label">Label After</span>
<igx-switch labelPosition="after" [checked]="true">
<span>Power</span>
</igx-switch>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@use "igniteui-angular/theming" as *;
@use "sass:map";

:host {
display: flex;
min-block-size: 100%;
box-sizing: border-box;
place-content: center;
place-items: center;
padding: 16px;

@include tokens(switch-theme($schema: map.get($light-material-schema, switch)));
}

.variants {
--variant-gap: 60px;
--label-gap: 30px;

display: flex;
inline-size: 100%;
align-items: center;
justify-content: center;
gap: var(--variant-gap);

.variants__item {
display: flex;
align-items: center;
gap: var(--label-gap);
}

.variants__label {
font: 500 14px / 24px "Aktiv Grotesk", sans-serif;
letter-spacing: 0.1px;
color: var(--ig-gray-600);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { IgxSwitchComponent } from 'igniteui-angular/switch';

@Component({
selector: 'app-switch-layout',
styleUrls: ['./switch-layout.component.scss'],
templateUrl: './switch-layout.component.html',
imports: [IgxSwitchComponent]
})
export class SwitchLayoutComponent { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="notifications">
<h6 class="notifications__title">Notifications</h6>
<div class="notifications__row">
<igx-switch labelPosition="before" [checked]="true">
<span class="option">
<span class="option__label">Push notifications</span>
<span class="option__hint">Deliver alerts to this device</span>
</span>
</igx-switch>
</div>
<div class="notifications__row">
<igx-switch labelPosition="before">
<span class="option">
<span class="option__label">Weekly digest</span>
<span class="option__hint">Summary email every Monday</span>
</span>
</igx-switch>
</div>
<div class="notifications__row">
<igx-switch labelPosition="before" [disabled]="true">
<span class="option">
<span class="option__label">SMS alerts</span>
<span class="option__hint">Unavailable on your plan</span>
</span>
</igx-switch>
</div>
</div>
Loading