-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Styled-components + TS w/ eslint (#104)
- Loading branch information
Showing
147 changed files
with
7,244 additions
and
5,955 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
extends: ["next"], | ||
rules: { | ||
"import/no-anonymous-default-export": "off", | ||
"react/no-unescaped-entities": "off", | ||
"react/display-name": "off", | ||
}, | ||
ignorePatterns: ["src/**/*.stories.js"], | ||
|
||
overrides: [ | ||
{ | ||
files: ["src/**/*.ts", "src/**/*.tsx"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: "module", | ||
project: "./tsconfig.json", | ||
tsConfigRootDir: path.resolve(__dirname), | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"next/core-web-vitals", | ||
], | ||
rules: { | ||
"@typescript-eslint/no-unsafe-assessment": "off", | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
"@typescript-eslint/require-await": ["error"], | ||
"@typescript-eslint/no-unsafe-return": ["error"], | ||
"@typescript-eslint/no-unsafe-call": ["error"], | ||
"@typescript-eslint/no-unsafe-argument": ["error"], | ||
"@typescript-eslint/no-unsafe-member-access": ["error"], | ||
"@typescript-eslint/no-non-null-assertion": ["error"], | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"no-unused-vars": "off", | ||
"require-await": "off", | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ build-storybook.log | |
.env | ||
.python-version | ||
docker-compose.override.yml | ||
|
||
# ts linter | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,4 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"next/babel", | ||
{ | ||
"styled-jsx": { | ||
"plugins": [ | ||
"styled-jsx-plugin-postcss" | ||
] | ||
} | ||
} | ||
] | ||
] | ||
"presets": [["next/babel"]], | ||
"plugins": [["styled-components", { "ssr": true }]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import styled from "styled-components"; | ||
import { color } from "lib/variables"; | ||
|
||
export const StyledAccordion = styled.div` | ||
.accordion-meta-heading { | ||
display: flex; | ||
justify-content: space-between; | ||
background: ${color.lightestGrey}; | ||
padding: 5px 20px; | ||
} | ||
.accordion-heading { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 20px 12px; | ||
border: 1px solid ${color.lightestGrey}; | ||
background: ${color.white}; | ||
cursor: pointer; | ||
word-break: break-word; | ||
&.minified { | ||
padding: 1em; | ||
} | ||
> div { | ||
padding: 0 6px; | ||
} | ||
&.cols-6 { | ||
> div { | ||
width: calc(100% / 6); | ||
text-align: center; | ||
} | ||
.identifier { | ||
text-align: left; | ||
} | ||
} | ||
.identifier { | ||
width: 40%; | ||
} | ||
.source { | ||
width: 15%; | ||
} | ||
.associatedPackage { | ||
width: 15%; | ||
} | ||
.severity { | ||
width: 12.5%; | ||
} | ||
.created { | ||
width: 20%; | ||
} | ||
.severityScore { | ||
width: 10%; | ||
} | ||
.projectsAffected { | ||
width: 17.5%; | ||
text-align: right; | ||
} | ||
} | ||
`; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { useState, Fragment, FC } from "react"; | ||
import { StyledAccordion } from "./StyledAccordion"; | ||
|
||
interface AccordionProps { | ||
children: JSX.Element[]; | ||
defaultValue?: boolean; | ||
minified?: boolean; | ||
className?: string; | ||
onToggle?: (visibility: boolean) => void; | ||
columns?: { [key: string]: string } | string[]; | ||
} | ||
|
||
const Accordion: FC<AccordionProps> = ({ | ||
children, | ||
defaultValue = true, | ||
minified = false, | ||
className = "", | ||
onToggle, | ||
columns, | ||
}) => { | ||
const [visibility, setVisibility] = useState(defaultValue); | ||
const accordionType = minified ? "minified" : "wide"; | ||
const colCountClass = columns && "cols-" + String(Object.keys(columns).length); | ||
|
||
return ( | ||
<StyledAccordion className={className}> | ||
<div | ||
className={`accordion-heading ${accordionType} ${colCountClass ? colCountClass : ""}`} | ||
onClick={() => { | ||
setVisibility(!visibility); | ||
if (onToggle) onToggle(!visibility); | ||
}} | ||
> | ||
{columns && | ||
Object.keys(columns).map((item, i) => ( | ||
<div key={i} className={item}> | ||
{columns[item]} | ||
</div> | ||
))} | ||
</div> | ||
|
||
{visibility ? <Fragment>{children}</Fragment> : null} | ||
</StyledAccordion> | ||
); | ||
}; | ||
|
||
export default Accordion; |
24 changes: 24 additions & 0 deletions
24
src/components/ActiveStandbyConfirm/StyledActiveStandbyConfirm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import styled from "styled-components"; | ||
import { color } from "lib/variables"; | ||
|
||
export const StyledActiveStandbyConfirm = styled.div` | ||
.margins { | ||
margin-right: 10px; | ||
} | ||
input { | ||
margin-right: 10px; | ||
width: 100%; | ||
} | ||
.environment-name { | ||
font-weight: bold; | ||
color: ${color.lightBlue}; | ||
} | ||
a.hover-state { | ||
margin-right: 10px; | ||
color: ${color.blue}; | ||
} | ||
.form-input { | ||
display: flex; | ||
align-items: center; | ||
} | ||
`; |
Oops, something went wrong.