Skip to content

Commit

Permalink
feat(html): make 'Write a review' button public
Browse files Browse the repository at this point in the history
  • Loading branch information
vednoc committed Aug 10, 2021
1 parent a3958e7 commit ae40992
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions scss/ui/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ hr { border: none; border-top: 1px solid var(--bg-3) }
}
}

&[disabled] {
color: var(--fg-4);
border-color: var(--bg-3);
}

// Override light mode colors.
[data-color-scheme="light"] & {
&.primary, &.stylus {
Expand Down
4 changes: 0 additions & 4 deletions typescript/page/view-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ function checkIfStyleInstalled() {
if ('usw-style-info-response' === type && 'installed' === data.requestType) {
window.removeEventListener('message', onMessage);
if (data.installed) {
const writeReviewButton: HTMLAnchorElement = document.querySelector('#write-review');
if (writeReviewButton) {
writeReviewButton.style.display = '';
}
const installButton: HTMLAnchorElement = document.querySelector('#install');
if (installButton) {
// Need to user innerHTML to preserve the icon.
Expand Down
19 changes: 11 additions & 8 deletions views/style/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ <h1 class="mb:m">{{ .Style.Name -}}
href="https://github.com/openstyles/stylus/#readme"
id="stylus" class="btn icon stylus ml:s"
>{{ template "icons/brush" 16 }} Get Stylus</a>
{{ if .User.ID }}
<a
target="_blank"
rel="noopener"
href="/styles/review/{{ $.Style.ID }}"
style="display: none"
id="write-review" class="btn icon write-review ml:s">Write a review</a>
{{ end }}
<a
id="write-review" class="btn icon write-review ml:s"
{{ if not .User.ID }}
disabled
tooltip-data="An account is required in order to review userstyles."
{{ else }}
target="_blank"
rel="noopener"
href="/styles/review/{{ $.Style.ID }}"
{{ end }}
>Write a review</a>
</span>
</div>

Expand Down

0 comments on commit ae40992

Please sign in to comment.