mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-05-18 07:54:49 +02:00
feat(site): Adds survey overlay to website (#4380)
* Finalize overlay * Minor fix * Remove if * cleanup * Revert theme config change * Remove comments * Format code * Use localstorage instead of session storage * Improve css * Update old-package link
This commit is contained in:
160
docs/.vitepress/theme/components/SurveyAskOverlay.vue
Normal file
160
docs/.vitepress/theme/components/SurveyAskOverlay.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<script setup lang="ts">
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
import IconButton from './base/IconButton.vue';
|
||||
import { x } from '../../data/iconNodes';
|
||||
import Icon from '@lucide/vue/src/Icon';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import VPButton from 'vitepress/dist/client/theme-default/components/VPButton.vue';
|
||||
|
||||
const showAskSurvey = useLocalStorage('show-ask-overlay', true, {
|
||||
initOnMounted: true,
|
||||
});
|
||||
|
||||
const delayedShow = ref(false)
|
||||
|
||||
const showPopup = computed(() => showAskSurvey.value && delayedShow.value );
|
||||
let isInitialized = false
|
||||
|
||||
function startTally() {
|
||||
window.Tally.openPopup('EkvOpB', {
|
||||
layout: 'modal',
|
||||
width: 700,
|
||||
autoClose: 5000,
|
||||
onClose() {
|
||||
showAskSurvey.value = false;
|
||||
},
|
||||
onSubmit() {
|
||||
showAskSurvey.value = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
setTimeout(() => {
|
||||
delayedShow.value = true
|
||||
}, 10000)
|
||||
})
|
||||
|
||||
function initTally() {
|
||||
try {
|
||||
if (!isInitialized) {
|
||||
isInitialized = true
|
||||
const s = document.createElement('script')
|
||||
s.src = `//tally.so/widgets/embed.js`
|
||||
s.async = true
|
||||
s.onload = startTally
|
||||
document.body.appendChild(s)
|
||||
} else {
|
||||
startTally();
|
||||
}
|
||||
} catch (error) {
|
||||
window.open('https://tally.so/r/EkvOpB', '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
function hidePopup() {
|
||||
showAskSurvey.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
:class="{
|
||||
'show-popup': showPopup,
|
||||
}"
|
||||
class="ask-overlay"
|
||||
>
|
||||
<IconButton
|
||||
@click="hidePopup"
|
||||
class="hide-button"
|
||||
>
|
||||
<Icon
|
||||
:iconNode="x"
|
||||
:size="20"
|
||||
absoluteStrokeWidth
|
||||
/>
|
||||
</IconButton>
|
||||
|
||||
<h2 class="title">
|
||||
We value your feedback!
|
||||
</h2>
|
||||
|
||||
<p class="description">
|
||||
Can you spare a moment to take our survey? <br>Your feedback helps us improve Lucide and make it better for everyone.
|
||||
</p>
|
||||
|
||||
<div class="buttons">
|
||||
<VPButton
|
||||
text="Take the Survey"
|
||||
theme="brand"
|
||||
@click="initTally"
|
||||
/>
|
||||
|
||||
<VPButton
|
||||
text="Close"
|
||||
theme="alt"
|
||||
@click="hidePopup"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ask-overlay {
|
||||
position: fixed;
|
||||
z-index: 99;;
|
||||
bottom: 24px;
|
||||
width: calc(100% - 48px);
|
||||
max-width: 420px;
|
||||
left: 24px;
|
||||
transition:
|
||||
opacity 0.25s,
|
||||
transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--vp-shadow-4);
|
||||
background-color: var(--vp-carbon-ads-bg-color);
|
||||
opacity: 0;
|
||||
transform: translateY(200px);
|
||||
}
|
||||
|
||||
.ask-overlay .title {
|
||||
line-height: 24px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ask-overlay .description {
|
||||
padding-top: 8px;
|
||||
line-height: 24px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.ask-overlay.show-popup {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
transition:
|
||||
opacity 0.5s,
|
||||
transform 0.25s ease;
|
||||
}
|
||||
|
||||
.ask-overlay .buttons {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.hide-button {
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
z-index: 3;
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
@@ -3,6 +3,7 @@ import { useData } from 'vitepress';
|
||||
import { useSidebar } from 'vitepress/dist/client/theme-default/composables/sidebar';
|
||||
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
|
||||
import { computed } from 'vue';
|
||||
import SurveyAskOverlay from '../SurveyAskOverlay.vue';
|
||||
|
||||
const { theme } = useData();
|
||||
const { hasSidebar } = useSidebar();
|
||||
@@ -41,6 +42,7 @@ const links = computed(() => [
|
||||
class="VPFooter"
|
||||
:class="{ 'has-sidebar': hasSidebar }"
|
||||
>
|
||||
<SurveyAskOverlay/>
|
||||
<div class="container">
|
||||
<div class="sponsors">
|
||||
<a
|
||||
|
||||
@@ -7,7 +7,6 @@ import IconsSidebarNavAfter from './layouts/IconsSidebarNavAfter.vue';
|
||||
import HomeHeroIconsCard from './components/home/HomeHeroIconsCard.vue';
|
||||
import HomeHeroAfter from './components/home/HomeHeroAfter.vue';
|
||||
import HomeHeroInfoBefore from './components/home/HomeHeroInfoBefore.vue';
|
||||
import LayoutTop from './components/base/LayoutTop.vue';
|
||||
import { ICON_STYLE_CONTEXT, iconStyleContext } from './composables/useIconStyle';
|
||||
import { CATEGORY_VIEW_CONTEXT, categoryViewContext } from './composables/useCategoryView';
|
||||
import { EXTERNAL_LIBS_CONTEXT, externalLibContext } from './composables/useExternalLibs';
|
||||
|
||||
38
docs/.vitepress/types.d.ts
vendored
38
docs/.vitepress/types.d.ts
vendored
@@ -46,5 +46,43 @@ declare global {
|
||||
*/
|
||||
append(container: Element): void;
|
||||
};
|
||||
Tally: {
|
||||
// From https://tally.so/help/developer-resources#2f676e40530a460ea6a634b8441f6001
|
||||
openPopup: (
|
||||
formId: string,
|
||||
options?: {
|
||||
key?: string; // This is used as a unique identifier used for the "Show only once" and "Don't show after submit" functionality
|
||||
layout?: 'default' | 'modal';
|
||||
width?: number;
|
||||
alignLeft?: boolean;
|
||||
hideTitle?: boolean;
|
||||
overlay?: boolean;
|
||||
emoji?: {
|
||||
text: string;
|
||||
animation:
|
||||
| 'none'
|
||||
| 'wave'
|
||||
| 'tada'
|
||||
| 'heart-beat'
|
||||
| 'spin'
|
||||
| 'flash'
|
||||
| 'bounce'
|
||||
| 'rubber-band'
|
||||
| 'head-shake';
|
||||
};
|
||||
autoClose?: number; // in milliseconds
|
||||
showOnce?: boolean;
|
||||
doNotShowAfterSubmit?: boolean;
|
||||
customFormUrl?: string; // when you want to load the form via it's custom domain URL
|
||||
hiddenFields?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
onOpen?: () => void;
|
||||
onClose?: () => void;
|
||||
onPageView?: (page: number) => void;
|
||||
onSubmit?: (payload: SubmissionPayload) => void;
|
||||
},
|
||||
) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
::: warning
|
||||
This documentation is for `@lucide/angular`.
|
||||
|
||||
To learn about our legacy package for Angular, please refer to [`lucide-angular`](./lucide-angular).
|
||||
To learn about our legacy package for Angular, please refer to [`lucide-angular`](https://v0.lucide.dev/guide/packages/lucide-angular).
|
||||
:::
|
||||
|
||||
A standalone, signal-based, zoneless implementation of Lucide icons for Angular.
|
||||
|
||||
**What you can accomplish:**
|
||||
|
||||
- Use icons as standalone Angular components with full dependency injection support
|
||||
- Configure icons globally through modern Angular providers
|
||||
- Integrate with Angular's reactive forms and data binding
|
||||
@@ -118,6 +119,7 @@ Alternatively, the component also accepts string inputs.
|
||||
To use icons this way, first, you have to provide icons via `provideLucideIcons`:
|
||||
|
||||
:::code-group
|
||||
|
||||
```ts{7-10} [app.config.ts]
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideLucideIcons, LucideCircleCheck, LucideCircleX } from '@lucide/angular';
|
||||
@@ -148,6 +150,7 @@ import { LucideIcon } from '@lucide/angular';
|
||||
})
|
||||
export class Foobar { }
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::: tip
|
||||
@@ -259,19 +262,25 @@ export class Foobar {
|
||||
## Troubleshooting
|
||||
|
||||
### The icon is not being displayed
|
||||
|
||||
If using per-icon-components:
|
||||
|
||||
1. Ensure that the icon component is being imported, if using per-icon-components
|
||||
2. Check that the icon name matches exactly (case-sensitive)
|
||||
|
||||
If using the dynamic component:
|
||||
|
||||
1. Ensure the icon is provided via `provideLucideIcons()` if using string names
|
||||
2. Verify the icon is imported from `@lucide/angular` and not the legacy package
|
||||
|
||||
### TypeScript errors?
|
||||
|
||||
Make sure you're importing from `@lucide/angular` and not `lucide-angular`.
|
||||
|
||||
### Icons render with wrong defaults
|
||||
|
||||
Ensure `provideLucideConfig()` is used at the right level.
|
||||
|
||||
## Migration guide
|
||||
|
||||
Migrating from `lucide-angular`? Read our [comprehensive migration guide](https://github.com/lucide-icons/lucide/blob/main/packages/angular/MIGRATION.md).
|
||||
|
||||
Reference in New Issue
Block a user