Skip to content

Commit 581b158

Browse files
Barthélémy Ledouxemilyrohrbough
andauthored
refactor: use Cypress design system icons in the SideBar (#22807)
* update alert icons * update icons package * use updated icons * update icon package * fix sidebar navigation icons * remove old windi package * fix test on NavigationRow * update design system * make clearer that iconColor is not a class * update tsc * rollback package updates * fix types * remove all changes from alert (another PR) * fix: apply suggestions from code review stylistic changes I can't argue with. Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com> * remove icons that are not used anymore * avoid installing unused packages Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
1 parent a710aaf commit 581b158

File tree

10 files changed

+64
-82
lines changed

10 files changed

+64
-82
lines changed

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"dependencies": {},
2121
"devDependencies": {
22+
"@cypress-design/vue-icon": "^0.4.2",
2223
"@graphql-typed-document-node/core": "^3.1.0",
2324
"@headlessui/vue": "1.4.0",
2425
"@iconify/iconify": "2.1.2",
@@ -63,7 +64,6 @@
6364
"vite-plugin-components": "0.11.3",
6465
"vite-plugin-pages": "0.18.1",
6566
"vite-plugin-vue-layouts": "0.6.0",
66-
"vite-plugin-windicss": "1.2.4",
6767
"vite-svg-loader": "3.1.2",
6868
"vue": "3.2.31",
6969
"vue-i18n": "9.2.0-beta.7",

packages/app/src/navigation/SidebarNavigation.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ import { computed, ref, watchEffect } from 'vue'
9393
import { gql, useMutation, useQuery } from '@urql/vue'
9494
import SidebarNavigationRow from './SidebarNavigationRow.vue'
9595
import KeyboardBindingsModal from './KeyboardBindingsModal.vue'
96-
import CodeIcon from '~icons/cy/code-editor_x24'
97-
import RunsIcon from '~icons/cy/runs_x24'
98-
import SettingsIcon from '~icons/cy/settings_x24'
96+
import {
97+
IconTechnologyCodeEditor,
98+
IconTechnologyTestResults,
99+
IconObjectGear,
100+
} from '@cypress-design/vue-icon'
99101
import Tooltip from '@packages/frontend-shared/src/components/Tooltip.vue'
100102
import HideDuringScreenshot from '../runner/screenshot/HideDuringScreenshot.vue'
101103
import { SideBarNavigationDocument, SideBarNavigation_SetPreferencesDocument } from '../generated/graphql'
@@ -108,10 +110,10 @@ import { useWindowSize } from '@vueuse/core'
108110
const { t } = useI18n()
109111
110112
const navigation = [
111-
{ name: 'Specs', icon: CodeIcon, href: '/specs' },
112-
{ name: 'Runs', icon: RunsIcon, href: '/runs' },
113-
{ name: 'Settings', icon: SettingsIcon, href: '/settings' },
114-
]
113+
{ name: 'Specs', icon: IconTechnologyCodeEditor, href: '/specs' },
114+
{ name: 'Runs', icon: IconTechnologyTestResults, href: '/runs' },
115+
{ name: 'Settings', icon: IconObjectGear, href: '/settings' },
116+
] as const
115117
116118
gql`
117119
fragment SidebarNavigation on Query {

packages/app/src/navigation/SidebarNavigationRow.cy.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import SidebarNavigationRow from './SidebarNavigationRow.vue'
2-
import BookIcon from '~icons/cy/book_x24'
3-
import SettingsIcon from '~icons/cy/settings_x24'
4-
import TestResultsIcon from '~icons/cy/test-results_x24'
5-
import PlaceholderIcon from '~icons/cy/placeholder_x24'
2+
import {
3+
IconTechnologyCodeEditor,
4+
IconTechnologyTestResults,
5+
IconObjectGear,
6+
IconGeneralPlaceholder,
7+
} from '@cypress-design/vue-icon'
68

79
describe('SidebarNavigationRow', () => {
810
it('renders something', () => {
911
cy.mount(() => (<div>
1012
<div
11-
class="resize-x overflow-auto space-y-4 h-500px w-256px bg-gray-900"
13+
class="space-y-4 bg-gray-900 h-500px w-256px resize-x overflow-auto"
1214
>
1315
<h2 class="text-white text-sm uppercase truncate">Tab Style</h2>
14-
<SidebarNavigationRow icon={BookIcon} name="book" active isNavBarExpanded/>
15-
<SidebarNavigationRow icon={SettingsIcon} name="settings" isNavBarExpanded/>
16-
<SidebarNavigationRow icon={TestResultsIcon} name="test-results" isNavBarExpanded/>
17-
<SidebarNavigationRow icon={PlaceholderIcon} name="placeholder" isNavBarExpanded/>
16+
<SidebarNavigationRow icon={IconTechnologyCodeEditor} name="book" active isNavBarExpanded/>
17+
<SidebarNavigationRow icon={IconTechnologyTestResults} name="settings" isNavBarExpanded/>
18+
<SidebarNavigationRow icon={IconObjectGear} name="test-results" isNavBarExpanded/>
19+
<SidebarNavigationRow icon={IconGeneralPlaceholder} name="placeholder" isNavBarExpanded/>
1820
</div>
1921
</div>))
2022
})

packages/app/src/navigation/SidebarNavigationRow.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,24 @@
2323
>
2424
<component
2525
:is="icon"
26-
:class="active ? 'icon-dark-indigo-300 icon-light-indigo-700' : 'icon-dark-gray-500 icon-light-gray-900 group-hover:(icon-dark-gray-300 icon-light-gray-800) group-focus:(icon-dark-gray-300 icon-light-gray-800)'"
27-
class="flex-shrink-0 h-24px m-12px w-24px
28-
children:transition children:duration-300"
26+
v-if="active"
27+
size="24"
28+
stroke-color="indigo-300"
29+
fill-color="indigo-700"
30+
class="flex-shrink-0 h-24px m-12px w-24px children:transition children:duration-300"
31+
/>
32+
<component
33+
:is="icon"
34+
v-else
35+
size="24"
36+
stroke-color="gray-500"
37+
fill-color="gray-900"
38+
hover-stroke-color="gray-300"
39+
hover-fill-color="gray-800"
40+
focus-stroke-color="gray-300"
41+
focus-fill-color="gray-800"
42+
interactive-colors-on-group
43+
class="flex-shrink-0 h-24px m-12px w-24px children:transition children:duration-300"
2944
/>
3045
<span
3146
:class="[active ? 'text-indigo-300' : 'text-gray-500 group-hocus:text-gray-300']"
@@ -45,7 +60,7 @@ import type { FunctionalComponent, SVGAttributes } from 'vue'
4560
import Tooltip from '@packages/frontend-shared/src/components/Tooltip.vue'
4661
4762
withDefaults(defineProps <{
48-
icon: FunctionalComponent<SVGAttributes, {}>
63+
icon: FunctionalComponent<SVGAttributes>
4964
name: string
5065
// Currently active row (generally the current route)
5166
active?: boolean

packages/frontend-shared/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {},
2020
"devDependencies": {
2121
"@antfu/utils": "^0.3.0",
22-
"@cypress-design/css": "0.4.1",
22+
"@cypress-design/css": "^0.5.2",
2323
"@graphql-typed-document-node/core": "^3.1.0",
2424
"@headlessui/vue": "1.4.0",
2525
"@iconify/json": "1.1.368",
@@ -67,7 +67,6 @@
6767
"unplugin-vue-components": "^0.15.4",
6868
"vite": "3.0.3",
6969
"vite-plugin-components": "0.11.3",
70-
"vite-plugin-windicss": "^1.4.7",
7170
"vite-svg-loader": "3.1.2",
7271
"vue": "3.2.31",
7372
"vue-eslint-parser": "7.11.0",

packages/frontend-shared/src/assets/icons/book_x24.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/frontend-shared/src/assets/icons/placeholder_x24.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/frontend-shared/src/assets/icons/settings_x24.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/launchpad/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"vite-plugin-components": "0.11.3",
6565
"vite-plugin-optimize-persist": "0.0.5",
6666
"vite-plugin-package-config": "0.0.3",
67-
"vite-plugin-windicss": "1.2.4",
6867
"vite-svg-loader": "3.1.2",
6968
"vue": "3.2.31",
7069
"vue-i18n": "9.2.0-beta.7",

yarn.lock

Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@
109109
execa "^5.1.1"
110110
find-up "^5.0.0"
111111

112-
"@antfu/utils@^0.2.4":
113-
version "0.2.4"
114-
resolved "https://registry.yarnpkg.com/@antfu/utils/-/utils-0.2.4.tgz#c7d33fc6faa0d3a6fcc2555673f5e9b19c0fbc15"
115-
integrity sha512-2bZNkVfL9IZESmvE26UKi8SzyvSoaIsGXDcnbHFMtmGMqUiB1fXpAJ1ijGf+tSqKRQ5yagck2U1Qk0p+705/kw==
116-
dependencies:
117-
"@types/throttle-debounce" "^2.1.0"
118-
119112
"@antfu/utils@^0.3.0":
120113
version "0.3.0"
121114
resolved "https://registry.yarnpkg.com/@antfu/utils/-/utils-0.3.0.tgz#6306c43b52a883bd8e973e3ed8dd64248418bcc4"
@@ -2438,16 +2431,31 @@
24382431
resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-9.0.1.tgz#c27b391d8457d1e893f1eddeaf5e5412d12ffbb5"
24392432
integrity sha512-6It2EVfGskxZCQhuykrfnALg7oVeiI6KclWSmGDqB0AiInVrTGB9Jp9i4/Ad21u9Jde/voVQz6eFX/eSg/UsPA==
24402433

2441-
"@cypress-design/css@0.4.1":
2442-
version "0.4.1"
2443-
resolved "https://registry.yarnpkg.com/@cypress-design/css/-/css-0.4.1.tgz#40c73462a1b8a04a2d045cef43d5e2480c3bbf2f"
2444-
integrity sha512-ycyrNcqm9Cy0+IrhVa7Ef9dSv+B/p69T0Sw6zhLDxHwq4S0YxtFgE4zf8R7O4SbR8vlU/YpV5GSQhaXCFLsQXg==
2434+
"@cypress-design/css@^0.5.2":
2435+
version "0.5.2"
2436+
resolved "https://registry.yarnpkg.com/@cypress-design/css/-/css-0.5.2.tgz#bcb43bb2d6f872de8691d6acb546680b335ea757"
2437+
integrity sha512-ZuHdhbcCgEfKuggGYS4AkSGfkB2ZCsWewBYUNH/U+oYnkhDITgaSMKp0RWfBWrnqqyhD2mTYx8gNRWCNQ7tw8w==
24452438
dependencies:
24462439
"@windicss/plugin-interaction-variants" "^1.0.0"
2440+
lodash "^4.17.21"
24472441
vite-plugin-windicss "^1.8.4"
24482442
windicss "^3.5.1"
24492443
windicss-webpack-plugin "^1.6.10"
24502444

2445+
"@cypress-design/icon-registry@^0.4.2":
2446+
version "0.4.2"
2447+
resolved "https://registry.yarnpkg.com/@cypress-design/icon-registry/-/icon-registry-0.4.2.tgz#bc2d913208acb33b5dfb1d8f6d7929b153e32ba0"
2448+
integrity sha512-iyH5xFc2abpwVPTEjoJ2ILIQy79DaR6ata76HAk9NHPWVUwG/yUPEzvp3m2T8IqgebNEuTtl4mBHM/u+jycxng==
2449+
dependencies:
2450+
camelcase "^6.3.0"
2451+
2452+
"@cypress-design/vue-icon@^0.4.2":
2453+
version "0.4.2"
2454+
resolved "https://registry.yarnpkg.com/@cypress-design/vue-icon/-/vue-icon-0.4.2.tgz#3574a749efbdaf83f48251108c016c3d383160bd"
2455+
integrity sha512-i7YWizC/c1LFdxVZSbyTIOrj4LeiIxypemCXdygacmvogQS2buBC+CovqCMFAzKqnfBZUBGiQajMWWM5rzIduw==
2456+
dependencies:
2457+
"@cypress-design/icon-registry" "^0.4.2"
2458+
24512459
"@cypress/browserify-preprocessor@3.0.0":
24522460
version "3.0.0"
24532461
resolved "https://registry.yarnpkg.com/@cypress/browserify-preprocessor/-/browserify-preprocessor-3.0.0.tgz#2d1fa6a96ed7130a1b172c540448a5955cbc1264"
@@ -8223,15 +8231,6 @@
82238231
"@webassemblyjs/wast-parser" "1.9.0"
82248232
"@xtuc/long" "4.2.2"
82258233

8226-
"@windicss/config@1.2.4":
8227-
version "1.2.4"
8228-
resolved "https://registry.yarnpkg.com/@windicss/config/-/config-1.2.4.tgz#24b36d30c1698fff14a9bacaebc93afaf2fe9019"
8229-
integrity sha512-81oah5NF7m/ltHrP2VpKu12qejP03erelNckH9ho86vuItsSd/tNehW3oJqOThZYsbuROCzIU55QDfe7MBd+Iw==
8230-
dependencies:
8231-
debug "^4.3.2"
8232-
jiti "^1.10.1"
8233-
windicss "^3.1.4"
8234-
82358234
"@windicss/config@1.8.4":
82368235
version "1.8.4"
82378236
resolved "https://registry.yarnpkg.com/@windicss/config/-/config-1.8.4.tgz#090c7f48cb86b6cba1bd97742a2f012852026d3c"
@@ -8246,19 +8245,6 @@
82468245
resolved "https://registry.yarnpkg.com/@windicss/plugin-interaction-variants/-/plugin-interaction-variants-1.0.0.tgz#11e412c6fd653899f6cced4e4f7b402eb5456981"
82478246
integrity sha512-jk0kvJEwphPlzjgCASxi0yCrLIrMPBHKTjPB1vF2LZsmWVaIPhKQRfpJW6+G093ipDos1E2BkevDrh/R2Ln8gg==
82488247

8249-
"@windicss/plugin-utils@1.2.4":
8250-
version "1.2.4"
8251-
resolved "https://registry.yarnpkg.com/@windicss/plugin-utils/-/plugin-utils-1.2.4.tgz#b319355d6e9b4e529c965b5a55af6d57679e417f"
8252-
integrity sha512-0G0zPx+gLfnP2isVMrsY+C0BDXASgFwtiT7g+YL+0LCTxjPxGOMnu5lCaAoYq+1LAskliPagqnu5mgKUYMyf2Q==
8253-
dependencies:
8254-
"@antfu/utils" "^0.2.4"
8255-
"@windicss/config" "1.2.4"
8256-
debug "^4.3.2"
8257-
fast-glob "^3.2.6"
8258-
magic-string "^0.25.7"
8259-
micromatch "^4.0.4"
8260-
windicss "^3.1.4"
8261-
82628248
"@windicss/plugin-utils@1.8.4", "@windicss/plugin-utils@^1.1.1", "@windicss/plugin-utils@^1.8.4":
82638249
version "1.8.4"
82648250
resolved "https://registry.yarnpkg.com/@windicss/plugin-utils/-/plugin-utils-1.8.4.tgz#fba74b6eb29276e24b9d09931bc22808fd7230d7"
@@ -11698,7 +11684,7 @@ camelcase@^5.0.0, camelcase@^5.2.0, camelcase@^5.3.1:
1169811684
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
1169911685
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
1170011686

11701-
camelcase@^6.0.0, camelcase@^6.2.0:
11687+
camelcase@^6.0.0, camelcase@^6.2.0, camelcase@^6.3.0:
1170211688
version "6.3.0"
1170311689
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
1170411690
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
@@ -21716,7 +21702,7 @@ jimp@^0.2.21:
2171621702
tinycolor2 "^1.1.2"
2171721703
url-regex "^3.0.0"
2171821704

21719-
jiti@^1.10.1, jiti@^1.13.0:
21705+
jiti@^1.13.0:
2172021706
version "1.13.0"
2172121707
resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.13.0.tgz#3cdfc4e651ca0cca4c62ed5e47747b5841d41a8e"
2172221708
integrity sha512-/n9mNxZj/HDSrincJ6RP+L+yXbpnB8FybySBa+IjIaoH9FIxBbrbRT5XUbe8R7zuVM2AQqNMNDDqz0bzx3znOQ==
@@ -35043,17 +35029,7 @@ vite-plugin-vue-layouts@0.6.0:
3504335029
debug "^4.3.2"
3504435030
fast-glob "^3.2.7"
3504535031

35046-
vite-plugin-windicss@1.2.4:
35047-
version "1.2.4"
35048-
resolved "https://registry.yarnpkg.com/vite-plugin-windicss/-/vite-plugin-windicss-1.2.4.tgz#b9ea60482dd8b6ba4fbc717ff5a9d17dedb0683b"
35049-
integrity sha512-U+mW8AiPRgC5wbUqjtvEIbZR3LzOwhNU0wnYQueT2SjjTfjlP74vcQg37yrULxycKibpdTYVHZuDuW4QkglPng==
35050-
dependencies:
35051-
"@windicss/plugin-utils" "1.2.4"
35052-
chalk "^4.1.1"
35053-
debug "^4.3.2"
35054-
windicss "^3.1.4"
35055-
35056-
vite-plugin-windicss@^1.4.7, vite-plugin-windicss@^1.8.4:
35032+
vite-plugin-windicss@^1.8.4:
3505735033
version "1.8.4"
3505835034
resolved "https://registry.yarnpkg.com/vite-plugin-windicss/-/vite-plugin-windicss-1.8.4.tgz#98430706691d54d6b9bf43ac0e3c74dd26b10664"
3505935035
integrity sha512-LSZAO8BZn3x406GRbYX5t5ONXXJVdqiQtN1qrznLA/Dy5/NzZVhfcrL6N1qEYYO7HsCDT4pLAjTzObvDnM9Y8A==
@@ -35992,7 +35968,7 @@ windicss-webpack-plugin@^1.6.10:
3599235968
webpack-virtual-modules "^0.4.3"
3599335969
windicss "^3.5.1"
3599435970

35995-
windicss@^3.1.4, windicss@^3.5.1:
35971+
windicss@^3.5.1:
3599635972
version "3.5.1"
3599735973
resolved "https://registry.yarnpkg.com/windicss/-/windicss-3.5.1.tgz#5e279c21179dbc122122d0b3a3a2651511249241"
3599835974
integrity sha512-E1hYZATcZFci/XhGS0sJAMRxULjnK+glNukE78Ku7xeb3jxgMY55fFOdIrav+GjQCsgR+IZxPq9/DwmO6eyc4Q==

0 commit comments

Comments
 (0)