Skip to content

Commit 2bfdf9b

Browse files
committed
feat: compare and retrieve versions
1 parent d4cf5f9 commit 2bfdf9b

File tree

13 files changed

+348
-26
lines changed

13 files changed

+348
-26
lines changed

packages/data-access/src/mappers/DashboardQuery.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export class DashboardQuery<TModel, TPartitionKeyFields extends keyof TModel, TR
2525
return new DashboardQuery(this.ModelClass, [...this.whereConditions, whereCondition]);
2626
}
2727

28+
public findPartitionKeyRange(
29+
start: string
30+
): DashboardQuery<TModel, TPartitionKeyFields, TRowKeyFields> {
31+
const whereCondition: string = odata`PartitionKey ge ${start}`;
32+
return new DashboardQuery(this.ModelClass, [...this.whereConditions, whereCondition]);
33+
}
34+
2835
public static create<TModel, TPartitionKeyFields extends keyof TModel, TRowKeyFields extends keyof TModel>(
2936
ModelClass: ModelClass<TModel, TPartitionKeyFields, TRowKeyFields>,
3037
): DashboardQuery<TModel, TPartitionKeyFields, TRowKeyFields> {

packages/stryker-elements/src/lib/atoms/dropdown.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { html } from 'lit';
1+
import { html, nothing } from 'lit';
22
import { customElement, property } from 'lit/decorators.js';
33
import { map } from 'lit/directives/map.js';
44

@@ -12,14 +12,27 @@ export class Dropdown extends BaseElement {
1212
@property({ type: Array })
1313
options: { name: string; value: string }[] = [];
1414

15+
@property({ type: String })
16+
selectedOption = '';
17+
18+
@property({ type: Boolean })
19+
withDisabledEmtpyOption = false;
20+
1521
render() {
1622
return html`
1723
<select
1824
id="${this.id}"
1925
class="w-full rounded-lg bg-neutral-800 p-2 text-3xl text-white"
2026
@change="${this.#handleChange}"
2127
>
22-
${map(this.options, (option) => html`<option value="${option.value}">${option.name}</option>`)}
28+
${when(
29+
this.withDisabledEmtpyOption,
30+
() => html`<option value="" disabled selected>Select an option</option>`,
31+
() => nothing
32+
)}
33+
${map(this.options, (option) => html`
34+
<option value="${option.value}" ?selected="${option.value === this.selectedOption}">${option.name}</option>
35+
`)}
2336
</select>
2437
`;
2538
}

packages/stryker-elements/src/lib/atoms/hr.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
import { html } from 'lit';
2-
import { customElement } from 'lit/decorators.js';
2+
import { customElement, property } from 'lit/decorators.js';
3+
import { classMap } from 'lit/directives/class-map.js';
34

45
import { BaseElement } from '../base-element';
56

67
@customElement('sme-hr')
78
export class Hr extends BaseElement {
9+
@property()
10+
direction: 'horizontal' | 'vertical' = 'horizontal';
11+
12+
@property()
13+
color: 'normal' | 'bright' = 'normal';
14+
815
render() {
9-
return html`<hr class="my-2 rounded border-t-[3px] border-neutral-700" />`;
16+
const color = classMap({ 'bg-neutral-700': this.color === 'normal', 'bg-neutral-400': this.color === 'bright' });
17+
18+
if (this.direction === 'vertical') {
19+
return html`<hr class="${color} w-[3px] rounded h-full" />`;
20+
}
21+
22+
return html`<hr class="${color} my-2 rounded border-t-[3px]" />`;
1023
}
1124
}
1225

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { html } from 'lit';
2+
import { customElement, property } from 'lit/decorators.js';
3+
4+
import { BaseElement } from '../base-element.js';
5+
import { classMap } from 'lit/directives/class-map.js';
6+
7+
@customElement('sme-split-layout')
8+
export class SplitLayout extends BaseElement {
9+
@property({ type: Boolean })
10+
withBackground = false;
11+
12+
render() {
13+
return html`
14+
<div class="flex p-4 ${classMap({ 'bg-elementsDark': this.withBackground })}">
15+
<div class="max-w-split">
16+
<slot name="left"></slot>
17+
</div>
18+
<sme-hr class="ml-2 mr-2" color="bright" direction="vertical"></sme-hr>
19+
<div class="max-w-split">
20+
<slot name="right"></slot>
21+
</div>
22+
</div>
23+
`;
24+
}
25+
}
26+
27+
declare global {
28+
interface HTMLElementTagNameMap {
29+
'sme-split-layout': SplitLayout;
30+
}
31+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { html, TemplateResult } from "lit";
2+
import { customElement, property, state } from "lit/decorators.js";
3+
import { map } from "lit/directives/map.js";
4+
import { classMap } from "lit/directives/class-map.js";
5+
6+
import { BaseElement } from "../base-element";
7+
8+
@customElement('sme-tab-panels')
9+
export class TabPanels extends BaseElement {
10+
@property({ type: Array })
11+
tabs: string[] = [];
12+
13+
@property({ type: Array })
14+
panels: TemplateResult<1>[] = [];
15+
16+
@state()
17+
activeTab: number = 0;
18+
19+
render() {
20+
return html`
21+
<div class="w-full h-full">
22+
<div class="flex bg-red-900 justify-center">
23+
${map(this.tabs, (tab, index) => {
24+
return html`
25+
<sme-button
26+
@click="${this.#handleTabChange}"
27+
class="${classMap({
28+
'bg-red-700': index === this.activeTab,
29+
'border-red-500': index === this.activeTab, // separate on multiple lines because it cannot contain whitespace
30+
'border-transparent': index !== this.activeTab
31+
})} border-0 border-b-2 px-2 font-bold transition text-md text-white"
32+
type="plain"
33+
>${tab}</sme-button>
34+
`;
35+
})}
36+
</div>
37+
<div class="w-full h-full">
38+
${map(this.panels, (panel, index) => {
39+
return html`
40+
<div id="panel-${index}" class="${classMap({ 'hidden': index !== this.activeTab })}">
41+
${panel}
42+
</div>
43+
`;
44+
})}
45+
</div>
46+
</div>
47+
`;
48+
}
49+
50+
#handleTabChange(e: Event) {
51+
const target = e.target as HTMLElement;
52+
const index = this.tabs.indexOf(target.innerText);
53+
this.activeTab = index;
54+
}
55+
}
56+
57+
58+
declare global {
59+
interface HTMLElementTagNameMap {
60+
'sme-tab-panels': TabPanels;
61+
}
62+
}
63+

packages/stryker-elements/src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export { Loader } from './lib/molecules/loader';
2626
export { Modal } from './lib/molecules/modal';
2727
export { ProfileButton } from './lib/molecules/profile-button';
2828
export { Repository } from './lib/molecules/repository';
29-
export { SupportedFrameworkList } from './lib/molecules/supported-framework-list';
29+
export { SplitLayout } from './lib/molecules/split-layout';
30+
export { TabPanels } from './lib/molecules/tab-panels';
3031
export { ToggleRepository } from './lib/molecules/toggle-repository';
3132

3233
// Organisms
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Meta, StoryObj } from '@storybook/web-components';
2+
import { html } from 'lit';
3+
4+
import '../../lib/atoms/hr';
5+
6+
export default {
7+
title: 'Atoms/Hr',
8+
} as Meta;
9+
10+
export const Default: StoryObj = {
11+
name: 'Default',
12+
render: () => html`<sme-hr></sme-hr>`,
13+
};
14+
15+
export const Vertical: StoryObj = {
16+
name: 'Vertical',
17+
render: () => html`<div style="height: 100px"><sme-hr direction="vertical"></sme-hr></div>`,
18+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Meta, StoryObj } from '@storybook/web-components';
2+
import { html } from 'lit';
3+
4+
import '../../lib/atoms/hr';
5+
import '../../lib/molecules/split-layout';
6+
7+
export default {
8+
title: 'Molecules/Split Layout',
9+
component: 'sme-split-layout',
10+
} as Meta;
11+
12+
export const Default: StoryObj = {
13+
name: 'Default',
14+
render: () => {
15+
return html`
16+
<sme-split-layout>
17+
<div slot="left">Left</div>
18+
<div slot="right">Right</div>
19+
</sme-split-layout>
20+
`;
21+
},
22+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Meta, StoryObj } from '@storybook/web-components';
2+
import { html } from 'lit';
3+
4+
import '../../lib/molecules/tab-panels';
5+
6+
export default {
7+
title: 'Molecules/Tab Panels',
8+
component: 'sme-tab-panels',
9+
} as Meta;
10+
11+
export const Default: StoryObj = {
12+
name: 'Default',
13+
render: () => {
14+
return html`<sme-tab-panels .tabs="${["Report", "Compare"]}" .panels="${[html`<div>report</div>`, html`<div>compare</div>`]}"></sme-tab-panels>`;
15+
},
16+
};

packages/stryker-elements/tailwind.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export default {
66
colors: {
77
background: '#242526',
88
hero_background: '#22323D',
9+
elementsDark: '#18181b',
10+
},
11+
spacing: {
12+
split: 'calc(50% - 9.5px)',
913
},
1014
keyframes: {
1115
something: {

0 commit comments

Comments
 (0)