Skip to content

Commit 9919207

Browse files
author
Mike Zorn
committed
prettier
1 parent 985e9ff commit 9919207

File tree

7 files changed

+118
-102
lines changed

7 files changed

+118
-102
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import globals from "globals";
2-
import pluginJs from "@eslint/js";
3-
import tseslint from "typescript-eslint";
4-
import pluginReact from "eslint-plugin-react";
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import pluginReact from 'eslint-plugin-react';
55

66
/** @type {import('eslint').Linter.Config[]} */
77
export default [
88
{
9-
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
9+
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
1010
},
1111
{ languageOptions: { globals: globals.browser } },
1212
pluginJs.configs.recommended,
@@ -15,10 +15,10 @@ export default [
1515
...pluginReact.configs.flat.recommended,
1616
rules: {
1717
...pluginReact.configs.flat.recommended.rules,
18-
"react/react-in-jsx-scope": "off",
18+
'react/react-in-jsx-scope': 'off',
1919
},
2020
},
2121
{
22-
ignores: ["**/__mocks__/"],
23-
}
22+
ignores: ['**/__mocks__/'],
23+
},
2424
];

internal/dev_server/ui/src/Flag.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ const VariationValues = ({
7272
];
7373
selectedVariationIndex = 0;
7474
}
75-
const onSubmit = (close: () => void) => (e: FormEvent<HTMLFormElement>) => {
76-
// Prevent default browser page refresh.
77-
e.preventDefault();
78-
const data = Object.fromEntries(new FormData(e.currentTarget));
79-
updateOverride(flagKey, JSON.parse(data.value as string));
80-
close();
81-
};
82-
75+
const onSubmit =
76+
(close: () => void) => (e: FormEvent<HTMLFormElement>) => {
77+
// Prevent default browser page refresh.
78+
e.preventDefault();
79+
const data = Object.fromEntries(new FormData(e.currentTarget));
80+
updateOverride(flagKey, JSON.parse(data.value as string));
81+
close();
82+
};
8383

8484
//TODO:
8585
// Grow the text area when editing local override
Lines changed: 75 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,76 @@
1-
21
.animated-switch-container {
3-
display: flex;
4-
align-items: center;
5-
justify-content: center;
6-
}
7-
8-
.animated-switch {
9-
--switch-width: 60px;
10-
--switch-height: calc(var(--switch-width) * 0.4);
11-
--switch-thumb-size: calc(var(--switch-height) * 0.8);
12-
13-
position: relative;
14-
display: inline-flex;
15-
align-items: center;
16-
justify-content: space-between;
17-
width: var(--switch-width);
18-
height: var(--switch-height);
19-
border-radius: calc(var(--switch-height) / 1.5);
20-
padding: 2px;
21-
background-color: #ccc;
22-
transition: background-color 0.1s ease-out;
23-
cursor: pointer;
24-
overflow: hidden;
25-
}
26-
27-
.animated-switch[data-selected] {
28-
background-color: #4CAF50;
29-
}
30-
31-
.animated-switch::before {
32-
content: "";
33-
position: absolute;
34-
left: 4px;
35-
width: var(--switch-thumb-size);
36-
height: var(--switch-thumb-size);
37-
border-radius: 50%;
38-
background-color: white;
39-
transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.3);
40-
z-index: 2;
41-
}
42-
43-
.animated-switch[data-selected]::before {
44-
transform: translateX(calc(var(--switch-width) - var(--switch-height)));
45-
}
46-
47-
.switch-text {
48-
font-size: 10px;
49-
font-weight: bold;
50-
position: absolute;
51-
right: 4px;
52-
top: 50%;
53-
transform: translateY(-50%);
54-
transition: opacity 0.3s ease-out;
55-
z-index: 1;
56-
user-select: none;
57-
}
58-
59-
.switch-text-false {
60-
right: 10px;
61-
color: #333;
62-
}
63-
64-
.switch-text-true {
65-
left: 10px;
66-
color: white;
67-
}
68-
69-
.animated-switch[data-selected] .switch-text-false,
70-
.animated-switch:not([data-selected]) .switch-text-true {
71-
opacity: 0;
72-
}
73-
74-
.animated-switch[data-selected] .switch-text-true,
75-
.animated-switch:not([data-selected]) .switch-text-false {
76-
opacity: 1;
77-
}
2+
display: flex;
3+
align-items: center;
4+
justify-content: center;
5+
}
6+
7+
.animated-switch {
8+
--switch-width: 60px;
9+
--switch-height: calc(var(--switch-width) * 0.4);
10+
--switch-thumb-size: calc(var(--switch-height) * 0.8);
11+
12+
position: relative;
13+
display: inline-flex;
14+
align-items: center;
15+
justify-content: space-between;
16+
width: var(--switch-width);
17+
height: var(--switch-height);
18+
border-radius: calc(var(--switch-height) / 1.5);
19+
padding: 2px;
20+
background-color: #ccc;
21+
transition: background-color 0.1s ease-out;
22+
cursor: pointer;
23+
overflow: hidden;
24+
}
25+
26+
.animated-switch[data-selected] {
27+
background-color: #4caf50;
28+
}
29+
30+
.animated-switch::before {
31+
content: '';
32+
position: absolute;
33+
left: 4px;
34+
width: var(--switch-thumb-size);
35+
height: var(--switch-thumb-size);
36+
border-radius: 50%;
37+
background-color: white;
38+
transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.3);
39+
z-index: 2;
40+
}
41+
42+
.animated-switch[data-selected]::before {
43+
transform: translateX(calc(var(--switch-width) - var(--switch-height)));
44+
}
45+
46+
.switch-text {
47+
font-size: 10px;
48+
font-weight: bold;
49+
position: absolute;
50+
right: 4px;
51+
top: 50%;
52+
transform: translateY(-50%);
53+
transition: opacity 0.3s ease-out;
54+
z-index: 1;
55+
user-select: none;
56+
}
57+
58+
.switch-text-false {
59+
right: 10px;
60+
color: #333;
61+
}
62+
63+
.switch-text-true {
64+
left: 10px;
65+
color: white;
66+
}
67+
68+
.animated-switch[data-selected] .switch-text-false,
69+
.animated-switch:not([data-selected]) .switch-text-true {
70+
opacity: 0;
71+
}
72+
73+
.animated-switch[data-selected] .switch-text-true,
74+
.animated-switch:not([data-selected]) .switch-text-false {
75+
opacity: 1;
76+
}
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
const React = require('react');
22

3-
exports.Button = ({ children, isDisabled, ...props }) => React.createElement('button', { ...props, disabled: isDisabled }, children);
4-
exports.ProgressBar = ({ isIndeterminate, ...props }) => React.createElement('div', { ...props, 'data-indeterminate': isIndeterminate }, null);
3+
exports.Button = ({ children, isDisabled, ...props }) =>
4+
React.createElement('button', { ...props, disabled: isDisabled }, children);
5+
exports.ProgressBar = ({ isIndeterminate, ...props }) =>
6+
React.createElement(
7+
'div',
8+
{ ...props, 'data-indeterminate': isIndeterminate },
9+
null,
10+
);
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const React = require('react');
22

3-
exports.Box = ({ children, alignItems, ...props }) => React.createElement('div', { ...props, style: { alignItems } }, children);
4-
exports.Inline = ({ children, ...props }) => React.createElement('div', props, children);
3+
exports.Box = ({ children, alignItems, ...props }) =>
4+
React.createElement('div', { ...props, style: { alignItems } }, children);
5+
exports.Inline = ({ children, ...props }) =>
6+
React.createElement('div', props, children);

internal/dev_server/ui/src/api.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@ export type FlagsApiResponse = {
2222
import { apiRoute } from './util';
2323
import { Environment } from './types';
2424

25-
export async function fetchEnvironments(projectKey: string, query?: string): Promise<Environment[]> {
26-
const res = await fetch(apiRoute(`/dev/projects/${projectKey}/environments?limit=20${query ? `&name=${query}` : ''}`));
25+
export async function fetchEnvironments(
26+
projectKey: string,
27+
query?: string,
28+
): Promise<Environment[]> {
29+
const res = await fetch(
30+
apiRoute(
31+
`/dev/projects/${projectKey}/environments?limit=20${query ? `&name=${query}` : ''}`,
32+
),
33+
);
2734
if (!res.ok) {
28-
throw new Error(`Got ${res.status}, ${res.statusText} from environments fetch`);
35+
throw new Error(
36+
`Got ${res.status}, ${res.statusText} from environments fetch`,
37+
);
2938
}
3039
return res.json();
3140
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { defineConfig } from 'vitest/config'
2-
import react from '@vitejs/plugin-react'
1+
import { defineConfig } from 'vitest/config';
2+
import react from '@vitejs/plugin-react';
33

44
export default defineConfig({
55
plugins: [react()],
66
test: {
77
environment: 'jsdom',
88
globals: true,
99
},
10-
})
10+
});

0 commit comments

Comments
 (0)