Skip to content

Commit

Permalink
Refactor status tag
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimdalen committed Nov 21, 2021
1 parent 27bf7c3 commit bf44936
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"base64-inline-loader": "^2.0.1",
"classnames": "^2.3.1",
"copy-webpack-plugin": "^10.0.0",
"css-loader": "^6.5.1",
"eslint": "^7.32.0",
Expand Down
8 changes: 6 additions & 2 deletions src/control/components/StatusTag.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import classNames from 'classnames';

import { AcceptanceCriteriaState } from '../../common/common';
export interface StatusTagProps {
state: AcceptanceCriteriaState;
Expand All @@ -6,6 +8,8 @@ export interface StatusTagProps {
const StatusTag = ({ state }: StatusTagProps): React.ReactElement => {
const getTagColor = () => {
switch (state) {
case AcceptanceCriteriaState.Unset:
return '#9b34eb';
case AcceptanceCriteriaState.Pending:
return 'orange';
case AcceptanceCriteriaState.Approved:
Expand All @@ -16,8 +20,8 @@ const StatusTag = ({ state }: StatusTagProps): React.ReactElement => {
};

return (
<span className="status-tag">
<div className="status-tag-indicator" style={{ backgroundColor: getTagColor() }}></div>
<span className={classNames('status-tag', [`status-tag-${state}`])}>
<div className="status-tag-indicator"></div>
{state}
</span>
);
Expand Down
15 changes: 15 additions & 0 deletions src/control/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
@import '../styles/mixins.scss';
@include extension-container('control-container');

@mixin status-tag-variant($name, $color) {
&-#{$name} {
.status-tag-indicator {
background-color: $color;
}
}
}

.add-criteria-button {
.ms-Icon {
color: rgba(var(--palette-accent2-dark, 16, 124, 16), 1);
Expand All @@ -18,6 +26,13 @@
width: 8px;
border-radius: 4px;
}
@include status-tag-variant('unset', #9b34eb);
@include status-tag-variant('pending', orange);
@include status-tag-variant('approved', green);
@include status-tag-variant('rejected', red);
}
.flex-self-center {
align-self: center;
}

.acceptance-critera-title-cell {
Expand Down

0 comments on commit bf44936

Please sign in to comment.