Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ThemeList and Portal styles make more visual for users #328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 22 additions & 26 deletions components/ThemeList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import LocaleUtils from '../utils/LocaleUtils';
import ThemeUtils from '../utils/ThemeUtils';
import Icon from './Icon';

import './style/ThemeList.css';
import './style/ThemeListPortal.css';
import './style/ThemeListSidebar.css';

class ThemeList extends React.Component {
static propTypes = {
Expand All @@ -45,7 +46,8 @@ class ThemeList extends React.Component {
setUserInfoFields: PropTypes.func,
showDefaultThemeSelector: PropTypes.bool,
showLayerAfterChangeTheme: PropTypes.bool,
themes: PropTypes.object
themes: PropTypes.object,
className: PropTypes.string
};
state = {
expandedGroups: [],
Expand Down Expand Up @@ -130,22 +132,6 @@ class ThemeList extends React.Component {
onClick={() => this.setTheme(item)}
title={title}
>
<div className="theme-item-title" title={item.title}>
<span>{item.title}</span>

</div>
{!isEmpty(infoLinks) ? (<div className={"theme-item-info-menu " + (this.state.visibleThemeInfoMenu ? "theme-item-info-menu-active" : "")} onClick={ev => this.toggleThemeInfoMenu(ev, item.id)}>
<Icon icon="info" />
{item.themeInfoLinks.title ? (<span>{item.themeInfoLinks.title}</span>) : LocaleUtils.tr(item.themeInfoLinks.titleMsgId)}
<Icon icon="triangle-down" />
{this.state.visibleThemeInfoMenu === item.id ? (
<div className="theme-item-info-links" onClick={ev => ev.stopPropagation()}>
{infoLinks.map(link => (
<a href={link.url} key={link.name} target={link.target}>{link.title}</a>
))}
</div>
) : null}
</div>) : null}
<div className="theme-item-body">
{item.description ? (<div className="theme-item-description" dangerouslySetInnerHTML={{__html: item.description}} />) : null}
<img className="theme-item-thumbnail" src={assetsPath + "/" + item.thumbnail} />
Expand All @@ -162,13 +148,22 @@ class ThemeList extends React.Component {
<Icon icon="lock" />
</div>
)}
{isEmpty(matches) ? null : (
<div className="theme-item-filterinfo-overlay">
{matches.map(match => (
<div key={match[0]} title={match[2]}><i>{LocaleUtils.tr(match[0])}:</i><br />{match[1][0]}<b>{match[1][1]}</b>{match[1][2]}</div>
))}
</div>
)}
<div className="theme-item-title" title={item.title}>
<span>{item.title}</span>

</div>
{!isEmpty(infoLinks) ? (<div className={"theme-item-info-menu " + (this.state.visibleThemeInfoMenu ? "theme-item-info-menu-active" : "")} onClick={ev => this.toggleThemeInfoMenu(ev, item.id)}>
<Icon icon="info" />
{item.themeInfoLinks.title ? (<span>{item.themeInfoLinks.title}</span>) : LocaleUtils.tr(item.themeInfoLinks.titleMsgId)}
<Icon icon="triangle-down" />
{this.state.visibleThemeInfoMenu === item.id ? (
<div className="theme-item-info-links" onClick={ev => ev.stopPropagation()}>
{infoLinks.map(link => (
<a href={link.url} key={link.name} target={link.target}>{link.title}</a>
))}
</div>
) : null}
</div>) : null}
</li>
);
})}
Expand All @@ -190,9 +185,10 @@ class ThemeList extends React.Component {
return false;
};
render() {
const { className } = this.props;
const filter = this.props.filter ? new RegExp(removeDiacritics(this.props.filter).replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&"), "i") : null;
return (
<div className="ThemeList">
<div className={`ThemeList ${className}`}>
{this.renderThemeGroup(this.props.themes, filter)}
</div>
);
Expand Down
197 changes: 197 additions & 0 deletions components/style/ThemeListPortal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
div.ThemeListPortal ul {
padding: 0;
list-style-type: none;
}

div.ThemeListPortal li.theme-group-header > span {
font-weight: bold;
display: flex;
align-items: center;
border-bottom: 1px solid var(--border-color);
padding: 0.25em;
margin: 0 0.5em 0.5em 0.5em;
}

div.ThemeListPortal li.theme-group-header > span > span.icon {
margin-right: 0.25em;
}

div.ThemeListPortal ul.theme-group-body {
padding: 0.25em;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
gap: 2.25em;
}

@media screen and (min-width: 426px) {
div.ThemeListPortal ul.theme-group-body {
display: flex;
justify-content: center;
flex-direction: row;
flex-wrap: wrap;
}
}

div.ThemeListPortal li.theme-group-header ul.theme-group-body {
margin-left: 0.25em;
}

div.ThemeListPortal li.theme-item {
font-weight: bold;
font-size: large;
text-align: center;
display: flex;
flex-direction: column;
width: 15em;
border-radius: 1.55em;
transition: all 0.3s cubic-bezier(0.4, 0, 1, 1);
position: relative;
overflow: hidden;
background-color: white;
border: none;
}

div.ThemeListPortal div.theme-item-title {
display: flex;
align-items: center;
padding: 0.3em 0;
order: 2;
background-color: white;
}

div.ThemeListPortal div.theme-item-title > span:first-child {
flex: 1 1 auto;
padding: 0.125em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

div.ThemeListPortal div.theme-item-title > span.icon {
flex: 0 0 auto;
padding: 0.125em;
font-size: large;
}

div.ThemeListPortal li.theme-item-active div.theme-item-title > span:first-child {
color: var(--color-active);
}

div.ThemeListPortal img.theme-item-thumbnail {
width: calc(15em - 2px);
height: auto;
border-radius: 1.55em;
order: 1;
}

div.ThemeListPortal div.theme-item-body {
order: 1;
}

div.ThemeListPortal div.theme-item-icons {
position: absolute;
bottom: 0;
right: 0;
display: flex;
flex-direction: column;
}

div.ThemeListPortal div.theme-item-icons > span.icon {
flex: 0 0 auto;
font-size: large;
padding: 0.25em;
background-color: var(--button-bg-color);
color: var(--text-color);
z-index: 2;
display: none;
}

div.ThemeListPortal div.theme-item-icons > span.icon:hover {
color: var(--color-active);
}

div.ThemeListPortal li.theme-item:hover div.theme-item-body {
background-color: transparent;
}
div.ThemeListPortal li.theme-item:hover {
background-color: lightgray !important;
border: none !important;
}
div.ThemeListPortal div.theme-item-icons > span.icon-active {
color: var(--color-active);
}
div.ThemeListPortal li.theme-item:hover div.theme-item-title {
background-color: transparent;
}
div.ThemeListPortal div.theme-item-keywords {
position: relative;
display: inline-block;
color: gray;
font-size: x-small;
font-weight: normal;
max-width: 80%;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

div.ThemeListPortal li.theme-item-active {
border: none;
}

div.ThemeListPortal div.theme-item-info-menu {
text-align: left;
display: flex;
align-items: center;
position: relative;
color: var(--color-active);
padding: 0.25em;
}

div.ThemeListPortal div.theme-item-info-menu-active {
background-color: var(--color-active);
color: white;
}

div.ThemeListPortal div.theme-item-info-menu > span.icon-info {
margin-right: 0.25em;
}

div.ThemeListPortal div.theme-item-info-menu > span.icon-triangle-down {
margin-left: 0.25em;
font-size: 80%;
}

div.ThemeListPortal div.theme-item-info-links {
position: absolute;
top: 100%;
max-width: calc(15em + 2px);
left: -1px;
right: -1px;
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid var(--color-active);
}

div.ThemeListPortal div.theme-item-info-links > a {
display: block;
text-align: left;
padding: 0.25em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

div.ThemeListPortal div.theme-item-restricted-overlay {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(127, 127, 127, 0.5);
display: flex;
align-items: center;
justify-content: center;
font-size: 400%;
}
Loading