Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure CSS linter stylelint #327

Merged
merged 6 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ repos:
entry: gitleaks detect --verbose --redact --baseline-path .gitleaks-report.json
language: golang

- repo: https://github.com/awebdeveloper/pre-commit-stylelint
rev: "0.0.2"
hooks:
- id: stylelint
additional_dependencies:
- [email protected]
- [email protected]
- [email protected]
args: ["--fix"]

# Configuration for https://pre-commit.ci/.
ci:
autoupdate_schedule: monthly
Expand Down
13 changes: 13 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "stylelint-config-standard",
"plugins": ["stylelint-order"],
"rules": {
"order/properties-alphabetical-order": true,
"selector-class-pattern": null,
"custom-property-pattern": null,
"color-function-notation": "legacy",
"alpha-value-notation": "number",
"color-hex-length": "long",
"selector-not-notation": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨

- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Removed

- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Changed

- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Deprecated

- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Security

- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
16 changes: 8 additions & 8 deletions vizro-ai/docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
.card-section-wrapper {
display: flex;
align-items: center;
display: flex;
}

.responsive-grid {
display: grid;
width: 100%;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
grid-auto-rows: auto;
gap: 1.5rem;
grid-auto-rows: auto;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
width: 100%;
}

.card-section-wrapper .responsive-grid a {
text-decoration: none;
transition: none;
background: none;
padding: 0;
color: black;
padding: 0;
text-decoration: none;
transition: none;
}

.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
height: 100%;
transition: 0.3s;
}

.card:hover {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨

- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Removed

- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Changed

- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Deprecated

- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Security

- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
20 changes: 11 additions & 9 deletions vizro-core/docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
.card-section-wrapper {
display: flex;
align-items: center;
display: flex;
}

.responsive-grid {
display: grid;
width: 100%;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
grid-auto-rows: auto;
gap: 1.5rem;
grid-auto-rows: auto;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
width: 100%;
}

.card-section-wrapper .responsive-grid a {
text-decoration: none;
transition: none;
background: none;
padding: 0;
color: black;
padding: 0;
text-decoration: none;
transition: none;
}

.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
height: 100%;
transition: 0.3s;
}

.card:hover {
Expand All @@ -45,18 +45,20 @@ td:not([class]):not(:last-child) {
:root {
--md-admonition-icon--details: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z"/></svg>');
}

.md-typeset .admonition.details,
.md-typeset details.details {
border-color: rgb(158, 158, 158);
}

.md-typeset .details > .admonition-title,
.md-typeset .details > summary {
background-color: rgba(245, 245, 245, 0.3);
opacity: 0.5;
}

.md-typeset .details > .admonition-title::before,
.md-typeset .details > summary::before {
background-color: rgb(3, 3, 3);
-webkit-mask-image: var(--md-admonition-icon--details);
mask-image: var(--md-admonition-icon--details);
}
2 changes: 1 addition & 1 deletion vizro-core/examples/_dev/assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#logo {
margin-left: -8px;
height: 40px;
margin-left: -8px;
}
6 changes: 3 additions & 3 deletions vizro-core/examples/demo/assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
img[src*="#my-image"] {
width: 100px;
height: 100px;
float: left;
height: 100px;
margin: 10px 25px;
width: 100px;
}

#logo {
margin-left: -8px;
height: 40px;
margin-left: -8px;
}
2 changes: 1 addition & 1 deletion vizro-core/examples/features/assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#logo {
margin-left: -8px;
height: 40px;
margin-left: -8px;
}
16 changes: 8 additions & 8 deletions vizro-core/src/vizro/static/css/accordion.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* media queries necessary for opening and closing accordion*/
/* media queries necessary for opening and closing accordion */
@media (prefers-reduced-motion: reduce) {
.fade {
transition: none;
Expand Down Expand Up @@ -51,13 +51,6 @@
color: var(--text-primary);
}

.accordion-button:not(.collapsed)::after {
background-position: left;
font-size: 16px;
font-weight: 600;
transform: scaleX(1.3) rotate(180deg);
}

.accordion-button::after {
background-repeat: no-repeat;
content: "\2304";
Expand All @@ -72,6 +65,13 @@
transition: transform 0.3s ease-in-out;
}

.accordion-button:not(.collapsed)::after {
background-position: left;
font-size: 16px;
font-weight: 600;
transform: scaleX(1.3) rotate(180deg);
}

.accordion-header {
font-size: var(--text-size-02);
}
Expand Down
4 changes: 2 additions & 2 deletions vizro-core/src/vizro/static/css/checklist.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
input[type="checkbox" i] {
align-items: center;
-webkit-appearance: none;
appearance: none;
border: 1px solid var(--text-secondary);
display: inline-flex;
height: 16px;
Expand All @@ -9,7 +9,7 @@ input[type="checkbox" i] {
width: 16px;
}

input[type="checkbox"]:checked:before {
input[type="checkbox"]:checked::before {
color: var(--text-primary);
content: "✓";
display: flex;
Expand Down
6 changes: 5 additions & 1 deletion vizro-core/src/vizro/static/css/collapse.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
transition: none;
}
}

.fade:not(.show) {
opacity: 0;
}
Expand All @@ -16,16 +17,19 @@
overflow: hidden;
transition: height 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
.collapsing {
transition: none;
}
}

.collapsing.collapse-horizontal {
width: 0;
height: auto;
transition: width 0.35s ease;
width: 0;
}

@media (prefers-reduced-motion: reduce) {
.collapsing.collapse-horizontal {
transition: none;
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/static/css/container.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.page-component-container {
height: 100%;
display: flex;
flex-direction: column;
height: 100%;
}
Loading
Loading