Skip to content

Commit

Permalink
refactor: use cypress design button in launchpad (#27795)
Browse files Browse the repository at this point in the history
* install button package in launchpad

* refactor: remove test that does not test anything

* fix: naive implementation

* fix the button bar

* finish the job

* some more fixes

* size = sm => 24

* restore global header

* make sure learn more opens in a new window

* simplify lean more

* a set of fixes

* fix open range

* Apply suggestions from code review

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>

* move constant after imports

* fix types

* fix: allow for mainvariant to be pending

* simplify import of button variants

* trigger

* remove the comment

* remove eslint ignores

* Revert "remove eslint ignores"

This reverts commit 9ffbcf2.

* remove useless no-duplicate imports

---------

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: Ryan Wilke <ryan@ryanwilke.com>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent ca0891e commit cdc42b9
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 95 deletions.
3 changes: 2 additions & 1 deletion packages/launchpad/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"dependencies": {},
"devDependencies": {
"@cypress-design/vue-button": "^0.11.0",
"@graphql-typed-document-node/core": "^3.1.0",
"@headlessui/vue": "1.4.0",
"@intlify/unplugin-vue-i18n": "0.10.0",
Expand Down Expand Up @@ -77,4 +78,4 @@
"@packages/graphql"
]
}
}
}
14 changes: 9 additions & 5 deletions packages/launchpad/src/components/code/FileRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
</p>
<Button
class="whitespace-nowrap"
href="https://on.cypress.io/guides/configuration"
size="32"
@click="openLearnMoreExternalLink"
>
{{ t('links.learnMoreButton') }}
</Button>
Expand All @@ -60,8 +61,8 @@
</template>

<script lang="ts">
import type { BadgeRowStatus } from '@cy/components/Badge.vue'
import type { FunctionalComponent, SVGAttributes, ComputedRef } from 'vue'
import type { BadgeRowStatus } from '@cy/components/Badge.vue'
export type FileRowStatus = 'changes' | 'valid' | 'skipped' | 'error';
Expand All @@ -74,10 +75,9 @@ export type StatusInfo = {
</script>
<script lang="ts" setup>
// eslint-disable-next-line no-duplicate-imports
import { computed } from 'vue'
import Button from '@cy/components/Button.vue'
// eslint-disable-next-line no-duplicate-imports
import Button from '@cypress-design/vue-button'
import { useExternalLink } from '@cy/gql-components/useExternalLink'
import Badge from '@cy/components/Badge.vue'
import { useI18n } from '@cy/i18n'
import ShikiHighlight from '@cy/components/ShikiHighlight.vue'
Expand All @@ -88,6 +88,8 @@ import SkippedIcon from '~icons/cy/file-changes-skipped_x24.svg'
import ErrorIcon from '~icons/cy/file-changes-error_x24.svg'
import WarningIcon from '~icons/cy/file-changes-warning_x24.svg'
const LEARN_MORE_URL = 'https://on.cypress.io/guides/configuration'
const { t } = useI18n()
const props = defineProps<{
Expand All @@ -98,6 +100,8 @@ const props = defineProps<{
fileExtension: string
}>()
const openLearnMoreExternalLink = useExternalLink(LEARN_MORE_URL)
const language = computed(() => {
// The fileExtension from FileParts is prepended with a period;
// we must strip the period to validate against our supported languages.
Expand Down
18 changes: 8 additions & 10 deletions packages/launchpad/src/global/GlobalPageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@
aria-controls="dropzone"
class="h-full text-[16px]"
data-cy="addProjectButton"
size="lg"
:variant="showDropzone ? 'pending' : 'primary'"
size="40"
:variant="showDropzone ? 'indigo-light' : 'indigo-dark'"
:aria-expanded="showDropzone"
@click="toggleDropzone"
>
<template #prefix>
<i-cy-add-large_x16
class="transform duration-150"
:class="showDropzone ?
'icon-dark-gray-100 rotate-45' : 'icon-dark-indigo-300'"
/>
</template>
<i-cy-add-large_x16
class="duration-150 transform mr-[8px]"
:class="showDropzone ?
'icon-dark-gray-100 rotate-45' : 'icon-dark-indigo-300'"
/>
{{ t('globalPage.addProjectButton') }}
</Button>
</div>
Expand All @@ -55,7 +53,7 @@

<script lang="ts" setup>
import { ref } from 'vue'
import Button from '@cy/components/Button.vue'
import Button from '@cypress-design/vue-button'
import Input from '@cy/components/Input.vue'
import FileDropzone from './FileDropzone.vue'
import { useModelWrapper } from '@packages/frontend-shared/src/composables'
Expand Down
8 changes: 3 additions & 5 deletions packages/launchpad/src/migration/MajorVersionWelcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,11 @@
>
<Button
class="group"
size="lg"
size="40"
@click="handleClick"
>
{{ t('majorVersionWelcome.actionContinue') }}
<template #suffix>
<i-cy-chevron-right_x16 class="icon-dark-white" />
</template>
<i-cy-chevron-right_x16 class="icon-dark-white ml-[8px]" />
</Button>
<ExternalLink
href="https://on.cypress.io/changelog"
Expand All @@ -198,7 +196,7 @@
</template>

<script lang="ts" setup>
import Button from '@cy/components/Button.vue'
import Button from '@cypress-design/vue-button'
import { useI18n } from '@cy/i18n'
import ExternalLink from '@packages/frontend-shared/src/gql-components/ExternalLink.vue'
import InlineCodeFragment from '@cy/components/InlineCodeFragment.vue'
Expand Down
36 changes: 15 additions & 21 deletions packages/launchpad/src/migration/MigrationWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ t('migration.wizard.title', { version: cypressMajorVersion }) }}
</h1>
<p
class="mt-2 text-center text-body-gray-600 text-lg"
class="mt-2 text-lg text-center text-body-gray-600"
>
{{ t('migration.wizard.description') }}
</p>
Expand All @@ -27,12 +27,11 @@
/>
<template #footer>
<Button
size="lg"
:suffix-icon="ArrowRightIcon"
suffix-icon-class="w-[16px] h-[16px] icon-dark-white"
size="40"
@click="renameSpecs"
>
{{ buttonTitle }}
<ArrowRightIcon class="ml-[8px] w-[16px] h-[16px] icon-dark-white" />
</Button>
</template>
</MigrationStep>
Expand All @@ -47,19 +46,17 @@
<div class="flex gap-[16px]">
<Button
v-if="migration.manualFiles?.completed"
size="lg"
:suffix-icon="ArrowRightIcon"
suffix-icon-class="w-[16px] h-[16px] icon-dark-white"
size="40"
@click="finishedRenamingComponentSpecs"
>
{{ t('migration.wizard.step2.buttonDone') }}
<ArrowRightIcon class="ml-[8px] w-[16px] h-[16px] icon-dark-white" />
</Button>
<Button
v-else
size="lg"
size="40"
disabled
variant="pending"
>
<template #prefix>
<i-cy-loading_x16
Expand All @@ -72,8 +69,8 @@
<Button
v-if="!migration.manualFiles?.completed"
size="lg"
variant="outline"
size="40"
variant="outline-light"
@click="skipStep2"
>
{{ t('migration.wizard.step2.button') }}
Expand All @@ -90,13 +87,12 @@
<RenameSupport :gql="migration" />
<template #footer>
<Button
size="lg"
:suffix-icon="ArrowRightIcon"
suffix-icon-class="w-[16px] h-[16px] icon-dark-white"
size="40"
data-cy="renameSupportButton"
@click="launchRenameSupportFile"
>
{{ t('migration.wizard.step3.button') }}
<ArrowRightIcon class="ml-[8px] w-[16px] h-[16px] icon-dark-white" />
</Button>
</template>
</MigrationStep>
Expand All @@ -109,13 +105,12 @@
<ConvertConfigFile :gql="migration" />
<template #footer>
<Button
size="lg"
:suffix-icon="ArrowRightIcon"
suffix-icon-class="w-[16px] h-[16px] icon-dark-white"
size="40"
data-cy="convertConfigButton"
@click="convertConfig"
>
{{ t('migration.wizard.step4.button') }}
<ArrowRightIcon class="ml-[8px] w-[16px] h-[16px] icon-dark-white" />
</Button>
</template>
</MigrationStep>
Expand All @@ -128,13 +123,12 @@
<SetupComponentTesting />
<template #footer>
<Button
size="lg"
:suffix-icon="ArrowRightIcon"
suffix-icon-class="w-[16px] h-[16px] icon-dark-white"
size="40"
data-cy="launchReconfigureButton"
@click="launchReconfigureComponentTesting"
>
{{ t('migration.wizard.step5.button') }}
<ArrowRightIcon class="w-[16px] h-[16px] icon-dark-white" />
</Button>
</template>
</MigrationStep>
Expand All @@ -150,7 +144,7 @@
import { computed, onBeforeMount, ref } from 'vue'
import { gql, useMutation, useQuery } from '@urql/vue'
import Spinner from '@cy/components/Spinner.vue'
import Button from '@cy/components/Button.vue'
import Button from '@cypress-design/vue-button'
import ArrowRightIcon from '~icons/cy/arrow-right_x16.svg'
import MigrationStep from './fragments/MigrationStep.vue'
import RenameSpecsAuto from './RenameSpecsAuto.vue'
Expand Down
4 changes: 2 additions & 2 deletions packages/launchpad/src/migration/OptOutModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
{{ t('migration.renameAuto.modal.buttonSave') }}
</Button>
<Button
variant="outline"
variant="outline-light"
@click="emit('cancel')"
>
{{ t('migration.renameAuto.modal.buttonCancel') }}
Expand All @@ -113,7 +113,7 @@
<script lang="ts" setup>
import { ref } from 'vue'
import Alert from '@cy/components/Alert.vue'
import Button from '@cy/components/Button.vue'
import Button from '@cypress-design/vue-button'
import CodeTag from '@cy/components/CodeTag.vue'
import StandardModal from '@cy/components/StandardModal.vue'
import Radio from '@cy/components/Radio.vue'
Expand Down
32 changes: 13 additions & 19 deletions packages/launchpad/src/setup/ButtonBar.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<template>
<div class="border-t rounded-b flex bg-gray-50 border-t border-t-gray-100 py-[16px] px-[24px] gap-3">
<div class="rounded-b flex bg-gray-50 border-t border-t-gray-100 py-[16px] px-[24px] gap-3">
<slot>
<Button
v-if="nextFn"
size="lg"
size="40"
:disabled="!canNavigateForward"
:variant="mainVariant"
:variant="mainVariant === 'pending' ? 'disabled' : mainVariant"
@click="nextFn"
>
<template
<i-cy-loading_x16
v-if="mainVariant === 'pending'"
#prefix
>
<i-cy-loading_x16
v-if="mainVariant === 'pending'"
class="animate-spin icon-dark-white icon-light-gray-400"
/>
</template>
class="animate-spin icon-dark-white icon-light-gray-400 mr-[8px]"
/>
{{ next }}
</Button>
<Button
v-if="backFn"
size="lg"
variant="outline"
size="40"
variant="outline-light"
@click="backFn"
>
{{ back }}
Expand All @@ -48,8 +43,8 @@
</div>
<Button
v-if="skipFn"
size="lg"
variant="text"
size="40"
variant="link"
class="text-gray-500"
@click="skipFn"
>
Expand All @@ -62,8 +57,7 @@

<script lang="ts" setup>
import { ref } from 'vue'
import type { ButtonVariants } from '@cy/components/Button.vue'
import Button from '@cy/components/Button.vue'
import Button, { type ButtonVariants } from '@cypress-design/vue-button'
import Switch from '@cy/components/Switch.vue'
const props = withDefaults(defineProps<{
Expand All @@ -76,7 +70,7 @@ const props = withDefaults(defineProps<{
alt?: string
altFn?: (value: boolean) => void
canNavigateForward?: boolean
mainVariant?: ButtonVariants
mainVariant?: ButtonVariants | 'pending'
}>(), {
alt: undefined,
altFn: undefined,
Expand All @@ -86,7 +80,7 @@ const props = withDefaults(defineProps<{
backFn: undefined,
nextFn: undefined,
skipFn: undefined,
mainVariant: 'primary',
mainVariant: 'indigo-dark',
})
const altValue = ref(false)
Expand Down
2 changes: 1 addition & 1 deletion packages/launchpad/src/setup/InstallDependencies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:back-fn="props.backFn"
:next-fn="confirmInstalled"
class="max-w-[640px] relative"
:main-button-variant="allDependenciesInstalled ? 'primary' : 'pending'"
:main-button-variant="allDependenciesInstalled ? 'indigo-dark' : 'disabled'"
:skip-fn="!allDependenciesInstalled ? confirmInstalled : undefined"
>
<template
Expand Down
Loading

2 comments on commit cdc42b9

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on cdc42b9 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.4/linux-x64/develop-cdc42b996f25d39e68cc562f51921098922b2f05/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on cdc42b9 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.4/linux-arm64/develop-cdc42b996f25d39e68cc562f51921098922b2f05/cypress.tgz

Please sign in to comment.