Skip to content

Commit

Permalink
Add sensitive button
Browse files Browse the repository at this point in the history
It's not hooked up.
  • Loading branch information
bcomnes committed Jun 10, 2022
1 parent fcfc666 commit 9068747
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 66 deletions.
3 changes: 2 additions & 1 deletion web/components/bookmark/bookmark-view.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../unread';
@import '../toread';
@import '../star';
@import '../sensitive';

.bc-bookmark-view {
padding-bottom: 4px;
Expand Down
9 changes: 5 additions & 4 deletions web/components/bookmark/bookmark-view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-env browser */
import { Component, html } from 'uland-isomorphic'
import { unreadIcon } from '../unread/index.js'
import { toread } from '../toread/index.js'
import { star } from '../star/index.js'
import { sensitive } from '../sensitive/index.js'

export const bookmarkView = Component(({
bookmark: b,
Expand All @@ -10,8 +11,9 @@ export const bookmarkView = Component(({
return html`
<div class="bc-bookmark-view">
<div>
${unreadIcon(b.toread)}
${star(b.starred)}
${toread({ toread: b.toread })}
${star({ starred: b.starred })}
${sensitive({ sensitive: b.sensitive })}
<a class="${b.toread ? 'bc-bookmark-title-toread' : null}" href="${b.url}" target="_blank">${b.title}</a>
</div>
<div class="bc-bookmark-url-display"><a href="${b.url}">${b.url}</a></div>
Expand All @@ -32,7 +34,6 @@ export const bookmarkView = Component(({
</time>
</a>
</div>
${b.sensitive ? html`<div>🤫</div>` : null}
<div>
<button onClick=${handleEdit}>edit</button>
</div>
Expand Down
57 changes: 0 additions & 57 deletions web/components/header.js

This file was deleted.

2 changes: 2 additions & 0 deletions web/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, html } from 'uland-isomorphic'
import { useUser } from '../../hooks/useUser.js'
import { useWindow } from '../../hooks/useWindow.js'
import { useLSP } from '../../hooks/useLSP.js'
import { sensitive } from '../sensitive/index.js'

export const header = Component(() => {
const { user } = useUser()
Expand Down Expand Up @@ -48,6 +49,7 @@ export const header = Component(() => {
: html`
<div>🔖 <a href='/bookmarks'>bookmarks</a></div>
<div>🏷 <a href='/tags'>tags</a></div>
<div>${sensitive({ sensitive: false })}</div>
<div>· <a href='/logout'>logout</a></div>`
}
Expand Down
7 changes: 7 additions & 0 deletions web/components/sensitive/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.bc-sensitive {

}

.bc-unsensitive {

}
14 changes: 14 additions & 0 deletions web/components/sensitive/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, html } from 'uland-isomorphic'

export const sensitive = Component(({
sensitive = false,
onClick = () => {}
}) => {
return html`
<span onClick=${onClick} class="${sensitive ? 'bc-sensitive' : 'bc-unsensitive'}" onClick=${onClick}>
${sensitive
? '🤫'
: '🫥'
}
</span>`
})
5 changes: 4 additions & 1 deletion web/components/star/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Component, html } from 'uland-isomorphic'

export const star = Component((starred = false, onClick = () => {}) => {
export const star = Component(({
starred = false,
onClick = () => {}
}) => {
return html`
<span onClick=${onClick} class="${starred ? 'bc-starred' : 'bc-unstarred'}" onClick=${onClick}>
${starred
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Component, svg, html } from 'uland-isomorphic'

export const unreadIcon = Component((toread = false, onClick = () => {}) => {
export const toread = Component(({
toread = false,
onClick = () => {}
}) => {
return html`
<span class="${toread ? 'bc-unread' : 'bc-read'}" onClick=${onClick}>
${toread
Expand Down
2 changes: 1 addition & 1 deletion web/global.client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { toggleTheme } from 'mine.css'
import 'fragmentions'
import { render } from 'uland-isomorphic'
import { header } from './components/header.js'
import { header } from './components/header/index.js'

window.toggleTheme = toggleTheme

Expand Down
2 changes: 1 addition & 1 deletion web/root.layout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html, render } from 'uland-isomorphic'
import { header } from './components/header.js'
import { header } from './components/header/index.js'

export default function defaultRootLayout ({
title,
Expand Down

0 comments on commit 9068747

Please sign in to comment.