Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
style(ui): run make format-ui
Browse files Browse the repository at this point in the history
Signed-off-by: András Jáky <[email protected]>
  • Loading branch information
akijakya committed Jul 25, 2024
1 parent 67dbcf7 commit 141ec28
Show file tree
Hide file tree
Showing 240 changed files with 12,337 additions and 9,530 deletions.
2 changes: 1 addition & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
9 changes: 3 additions & 6 deletions ui/src/api/axiosClient.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import axios from 'axios';
import axios from "axios";

const vmClarityApiAxiosClient = axios.create({
baseURL: `${window.location.origin}/api`,
});

const vmClarityUIBackendAxiosClient = axios.create({
baseURL: `${window.location.origin}/ui/api`,
baseURL: `${window.location.origin}/ui/api`,
});

export {
vmClarityApiAxiosClient,
vmClarityUIBackendAxiosClient,
};
export { vmClarityApiAxiosClient, vmClarityUIBackendAxiosClient };
4 changes: 2 additions & 2 deletions ui/src/api/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const QUERY_KEYS = {
assets: 'assets',
findings: 'findings',
assets: "assets",
findings: "findings",
};

export default QUERY_KEYS;
26 changes: 17 additions & 9 deletions ui/src/api/vmClarityApi.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { vmClarityApiAxiosClient, vmClarityUIBackendAxiosClient } from './axiosClient';
import { VMClarityUIBackendApi } from './generated-ui-backend';
import { VMClarityApi } from './generated-api';
import {
vmClarityApiAxiosClient,
vmClarityUIBackendAxiosClient,
} from "./axiosClient";
import { VMClarityUIBackendApi } from "./generated-ui-backend";
import { VMClarityApi } from "./generated-api";

const vmClarityApi = new VMClarityApi(undefined, undefined, vmClarityApiAxiosClient);
const vmClarityUIBackend = new VMClarityUIBackendApi(undefined, undefined, vmClarityUIBackendAxiosClient);
const vmClarityApi = new VMClarityApi(
undefined,
undefined,
vmClarityApiAxiosClient,
);
const vmClarityUIBackend = new VMClarityUIBackendApi(
undefined,
undefined,
vmClarityUIBackendAxiosClient,
);

export {
vmClarityApi,
vmClarityUIBackend,
};
export { vmClarityApi, vmClarityUIBackend };
20 changes: 10 additions & 10 deletions ui/src/components/Arrow/arrow.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.arrow-icon {
&.right-arrow {
transform: rotate(180deg);
}
&.top-arrow {
transform: rotate(90deg);
}
&.bottom-arrow {
transform: rotate(-90deg);
}
}
&.right-arrow {
transform: rotate(180deg);
}
&.top-arrow {
transform: rotate(90deg);
}
&.bottom-arrow {
transform: rotate(-90deg);
}
}
58 changes: 34 additions & 24 deletions ui/src/components/Arrow/index.jsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
import React from 'react';
import classnames from 'classnames';
import Icon, { ICON_NAMES } from 'components/Icon';
import React from "react";
import classnames from "classnames";
import Icon, { ICON_NAMES } from "components/Icon";

import './arrow.scss';
import "./arrow.scss";

export const ARROW_NAMES = {
TOP: "top",
BOTTOM: "bottom",
RIGHT: "right",
LEFT: "left"
}
TOP: "top",
BOTTOM: "bottom",
RIGHT: "right",
LEFT: "left",
};

const Arrow = ({name=ARROW_NAMES.TOP, onClick, disabled, small=false}) => {
if (!Object.values(ARROW_NAMES).includes(name)) {
console.error(`Arrow name '${name}' does not exist`);
}
const Arrow = ({
name = ARROW_NAMES.TOP,
onClick,
disabled,
small = false,
}) => {
if (!Object.values(ARROW_NAMES).includes(name)) {
console.error(`Arrow name '${name}' does not exist`);
}

return (
<Icon
name={ICON_NAMES.ARROW_HEAD_LEFT}
className={classnames("arrow-icon", `${name}-arrow`, {small}, {clickable: !!onClick})}
onClick={onClick}
disabled={disabled}
size={small ? 10 : 16}
/>
);
}
return (
<Icon
name={ICON_NAMES.ARROW_HEAD_LEFT}
className={classnames(
"arrow-icon",
`${name}-arrow`,
{ small },
{ clickable: !!onClick },
)}
onClick={onClick}
disabled={disabled}
size={small ? 10 : 16}
/>
);
};

export default Arrow;
export default Arrow;
24 changes: 12 additions & 12 deletions ui/src/components/BackRouteButton/back-route-button.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@import 'utils/scss_variables.module.scss';
@import "utils/scss_variables.module.scss";

.back-route-button {
color: $color-main;
display: flex;
align-items: center;
font-size: 18px;
line-height: 18px;
cursor: pointer;
margin-bottom: 24px;
color: $color-main;
display: flex;
align-items: center;
font-size: 18px;
line-height: 18px;
cursor: pointer;
margin-bottom: 24px;

.icon {
margin-right: 14px;
}
}
.icon {
margin-right: 14px;
}
}
28 changes: 14 additions & 14 deletions ui/src/components/BackRouteButton/index.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import Arrow, { ARROW_NAMES } from 'components/Arrow';
import React from "react";
import { useNavigate } from "react-router-dom";
import Arrow, { ARROW_NAMES } from "components/Arrow";

import './back-route-button.scss';
import "./back-route-button.scss";

const BackRouteButton = ({title, pathname}) => {
const navigate = useNavigate();
const BackRouteButton = ({ title, pathname }) => {
const navigate = useNavigate();

return (
<div className="back-route-button" onClick={() => navigate(pathname)}>
<Arrow name={ARROW_NAMES.LEFT} />
<div className="back-title">{title}</div>
</div>
)
}
return (
<div className="back-route-button" onClick={() => navigate(pathname)}>
<Arrow name={ARROW_NAMES.LEFT} />
<div className="back-title">{title}</div>
</div>
);
};

export default BackRouteButton;
export default BackRouteButton;
94 changes: 47 additions & 47 deletions ui/src/components/Button/button.scss
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
@import 'utils/scss_variables.module.scss';
@import "utils/scss_variables.module.scss";

.clarity-button {
border: none;
background-color: transparent;
height: 26px;
font-size: 12px;
border: none;
background-color: transparent;
height: 26px;
font-size: 12px;

&.clarity-button--primary,
&.clarity-button--secondary {
font-weight: 400;
line-height: 14px;
text-align: center;
box-sizing: border-box;
border-radius: 50px;
display: inline-block;
padding: 0px 20px;
&.clarity-button--primary,
&.clarity-button--secondary {
font-weight: 400;
line-height: 14px;
text-align: center;
box-sizing: border-box;
border-radius: 50px;
display: inline-block;
padding: 0px 20px;

&:disabled {
background-color: $color-grey-light;
color: $color-grey;
}
&:disabled {
background-color: $color-grey-light;
color: $color-grey;
}
&.clarity-button--primary {
background-color: $color-main-light;
color: $color-main-dark;
}
&.clarity-button--primary {
background-color: $color-main-light;
color: $color-main-dark;

&:hover:not(:disabled) {
background-color: $color-main-lighter;
}
&:hover:not(:disabled) {
background-color: $color-main-lighter;
}
&.clarity-button--secondary {
background-color: $color-blue;
color: $color-main-dark;
}
&.clarity-button--secondary {
background-color: $color-blue;
color: $color-main-dark;

&:hover:not(:disabled) {
background-color: $color-blue-light;
}
&:hover:not(:disabled) {
background-color: $color-blue-light;
}
&.clarity-button--tertiary {
line-height: 16px;
color: $color-main;
text-decoration: underline;
padding: 0;
}
&.clarity-button--tertiary {
line-height: 16px;
color: $color-main;
text-decoration: underline;
padding: 0;

&:hover:not(:disabled) {
color: $color-main-dark;
}
&:disabled {
color: $color-grey;
text-decoration: none;
}
}
&.clickable:not(:disabled) {
cursor: pointer;
&:hover:not(:disabled) {
color: $color-main-dark;
}
&:disabled {
cursor: not-allowed;
color: $color-grey;
text-decoration: none;
}
}
}
&.clickable:not(:disabled) {
cursor: pointer;
}
&:disabled {
cursor: not-allowed;
}
}
49 changes: 28 additions & 21 deletions ui/src/components/Button/index.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
import React from 'react';
import classnames from 'classnames';
import React from "react";
import classnames from "classnames";

import './button.scss';
import "./button.scss";

const Button = ({children, secondary, tertiary, disabled, onClick, className}) => (
<button
type="button"
className={classnames(
"clarity-button",
className,
{"clarity-button--primary": !secondary && !tertiary},
{"clarity-button--secondary": secondary},
{"clarity-button--tertiary": tertiary},
{clickable: !!onClick}
)}
disabled={disabled}
onClick={event => !disabled && onClick ? onClick(event) : null}
>
{children}
</button>
)
const Button = ({
children,
secondary,
tertiary,
disabled,
onClick,
className,
}) => (
<button
type="button"
className={classnames(
"clarity-button",
className,
{ "clarity-button--primary": !secondary && !tertiary },
{ "clarity-button--secondary": secondary },
{ "clarity-button--tertiary": tertiary },
{ clickable: !!onClick },
)}
disabled={disabled}
onClick={(event) => (!disabled && onClick ? onClick(event) : null)}
>
{children}
</button>
);

export default Button;
export default Button;
14 changes: 7 additions & 7 deletions ui/src/components/ButtonWithIcon/button-with-icon.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@import 'utils/scss_variables.module.scss';
@import "utils/scss_variables.module.scss";

.button-with-icon.clarity-button {
display: flex;
align-items: center;
display: flex;
align-items: center;

.icon {
margin-right: 5px;
}
}
.icon {
margin-right: 5px;
}
}
Loading

0 comments on commit 141ec28

Please sign in to comment.