Skip to content

Commit

Permalink
Provide a way to conveniently give star Armeria from the site (#4476)
Browse files Browse the repository at this point in the history
Motivation:

If a user stays on Armeria site (https://armeria.dev) for more than 10 seconds, we can assume they might be interested in our project and like to star Armeria on GitHub.

Modifications:

- Add a small banner to the left corner of the Armeria site.
  - It will be exposed 10 seconds after a user visits.

Result:

Gentle star marketing
  • Loading branch information
ikhoon authored Oct 11, 2022
1 parent 7d8d11a commit 096d707
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 56 deletions.
98 changes: 42 additions & 56 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"react-dom": "^17.0.2",
"react-easy-emoji": "^1.6.1",
"react-helmet": "^6.1.0",
"react-iframe-click": "^2.0.2",
"react-mixitup": "^2.3.0",
"react-reveal": "^1.2.2",
"react-sticky-box": "^1.0.2",
Expand Down
2 changes: 2 additions & 0 deletions site/src/layouts/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Footer from './footer';
import * as styles from './base.module.less';
import flashAtHash from './flash-at-hash';
import jumpToHash from './jump-to-hash';
import StarBegging from './star-begging';

const { Content } = Layout;

Expand Down Expand Up @@ -116,6 +117,7 @@ const BaseLayout: React.FC<BaseLayoutProps> = (props) => {
)}
<Footer />
</Layout>
<StarBegging />
<CookieConsent
declineButtonText="Opt out"
containerClasses={styles.cookieConsentContainer}
Expand Down
42 changes: 42 additions & 0 deletions site/src/layouts/star-begging.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#starBegging {
transition: transform .25s;
transform: scale(0);
border-radius: 8px;
position: fixed;
bottom: 32px;
right: 32px;
padding: 20px 40px 16px 20px;
background: #fff;
box-shadow: 0 1px 20px rgba(0, 0, 0, 0.15);
z-index: 9999998;

p {
font-size: 16px;
margin: 0 0 15px;
}

.close {
position: absolute;
right: 20px;
top: 20px;
height: 40px;
width: 40px;
line-height: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
font-family: arial, sans-serif;
cursor: pointer;
background: rgba(0, 0, 0, 0.05);
border-radius: 5px;
}
}

#starBegging.on {
transform: scale(1);
}
#starBegging.off {
transform: translateX(400px);
}

Loading

0 comments on commit 096d707

Please sign in to comment.