2023-02-07 23:24:57 +08:00
|
|
|
@use "sass:math";
|
|
|
|
|
2024-07-11 02:51:56 +08:00
|
|
|
.fk-d-menu[data-identifier="card"] {
|
|
|
|
max-width: calc(100vw - 2em);
|
|
|
|
width: auto;
|
|
|
|
.fk-d-menu__inner-content {
|
|
|
|
min-width: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-17 00:32:53 +08:00
|
|
|
.user-card,
|
|
|
|
.group-card {
|
2023-06-01 23:17:44 +08:00
|
|
|
--card-width: 39em;
|
|
|
|
--avatar-width: 8em;
|
|
|
|
--avatar-margin: -3.3em; // extends the avatar above the card
|
|
|
|
}
|
2015-08-19 04:28:02 +08:00
|
|
|
|
2019-04-24 16:55:09 +08:00
|
|
|
.animated-placeholder {
|
|
|
|
height: 20px;
|
|
|
|
position: relative;
|
|
|
|
}
|
2019-04-27 00:29:48 +08:00
|
|
|
|
2019-04-24 16:55:09 +08:00
|
|
|
.card-avatar-placeholder {
|
2023-06-01 23:17:44 +08:00
|
|
|
width: var(--avatar-width);
|
|
|
|
height: var(--avatar-width);
|
2019-04-24 16:55:09 +08:00
|
|
|
border-radius: 100%;
|
2019-04-27 00:29:48 +08:00
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
&:before {
|
2023-09-15 05:31:43 +08:00
|
|
|
@media (prefers-reduced-motion: no-preference) {
|
|
|
|
animation: placeHolderShimmer 4s linear infinite forwards;
|
|
|
|
}
|
2019-04-27 00:29:48 +08:00
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
content: "";
|
|
|
|
background: linear-gradient(
|
|
|
|
to right,
|
2020-08-04 10:57:10 +08:00
|
|
|
var(--primary-very-low) 10%,
|
|
|
|
var(--primary-low) 18%,
|
|
|
|
var(--primary-very-low) 33%
|
2019-04-27 00:29:48 +08:00
|
|
|
);
|
2023-06-01 23:17:44 +08:00
|
|
|
height: var(--avatar-width);
|
|
|
|
width: var(--card-width);
|
2019-04-27 00:29:48 +08:00
|
|
|
}
|
2019-04-24 16:55:09 +08:00
|
|
|
}
|
|
|
|
|
2019-03-20 17:45:49 +08:00
|
|
|
// shared styles for user and group cards
|
2020-02-13 17:58:17 +08:00
|
|
|
.user-card,
|
|
|
|
.group-card {
|
2024-07-09 05:30:43 +08:00
|
|
|
min-width: 0;
|
2023-06-01 23:17:44 +08:00
|
|
|
width: var(--card-width);
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
|
|
|
background: var(--secondary) center center;
|
2015-10-16 08:10:02 +08:00
|
|
|
background-size: cover;
|
DEV: FloatKit (#23650)
This PR introduces three new concepts to Discourse codebase through an addon called "FloatKit":
- menu
- tooltip
- toast
## Tooltips
### Component
Simple cases can be express with an API similar to DButton:
```hbs
<DTooltip
@Label={{i18n "foo.bar"}}
@ICON="check"
@content="Something"
/>
```
More complex cases can use blocks:
```hbs
<DTooltip>
<:trigger>
{{d-icon "check"}}
<span>{{i18n "foo.bar"}}</span>
</:trigger>
<:content>
Something
</:content>
</DTooltip>
```
### Service
You can manually show a tooltip using the `tooltip` service:
```javascript
const tooltipInstance = await this.tooltip.show(
document.querySelector(".my-span"),
options
)
// and later manual close or destroy it
tooltipInstance.close();
tooltipInstance.destroy();
// you can also just close any open tooltip through the service
this.tooltip.close();
```
The service also allows you to register event listeners on a trigger, it removes the need for you to manage open/close of a tooltip started through the service:
```javascript
const tooltipInstance = this.tooltip.register(
document.querySelector(".my-span"),
options
)
// when done you can destroy the instance to remove the listeners
tooltipInstance.destroy();
```
Note that the service also allows you to use a custom component as content which will receive `@data` and `@close` as args:
```javascript
const tooltipInstance = await this.tooltip.show(
document.querySelector(".my-span"),
{
component: MyComponent,
data: { foo: 1 }
}
)
```
## Menus
Menus are very similar to tooltips and provide the same kind of APIs:
### Component
```hbs
<DMenu @ICON="plus" @Label={{i18n "foo.bar"}}>
<ul>
<li>Foo</li>
<li>Bat</li>
<li>Baz</li>
</ul>
</DMenu>
```
They also support blocks:
```hbs
<DMenu>
<:trigger>
{{d-icon "plus"}}
<span>{{i18n "foo.bar"}}</span>
</:trigger>
<:content>
<ul>
<li>Foo</li>
<li>Bat</li>
<li>Baz</li>
</ul>
</:content>
</DMenu>
```
### Service
You can manually show a menu using the `menu` service:
```javascript
const menuInstance = await this.menu.show(
document.querySelector(".my-span"),
options
)
// and later manual close or destroy it
menuInstance.close();
menuInstance.destroy();
// you can also just close any open tooltip through the service
this.menu.close();
```
The service also allows you to register event listeners on a trigger, it removes the need for you to manage open/close of a tooltip started through the service:
```javascript
const menuInstance = this.menu.register(
document.querySelector(".my-span"),
options
)
// when done you can destroy the instance to remove the listeners
menuInstance.destroy();
```
Note that the service also allows you to use a custom component as content which will receive `@data` and `@close` as args:
```javascript
const menuInstance = await this.menu.show(
document.querySelector(".my-span"),
{
component: MyComponent,
data: { foo: 1 }
}
)
```
## Toasts
Interacting with toasts is made only through the `toasts` service.
A default component is provided (DDefaultToast) and can be used through dedicated service methods:
- this.toasts.success({ ... });
- this.toasts.warning({ ... });
- this.toasts.info({ ... });
- this.toasts.error({ ... });
- this.toasts.default({ ... });
```javascript
this.toasts.success({
data: {
title: "Foo",
message: "Bar",
actions: [
{
label: "Ok",
class: "btn-primary",
action: (componentArgs) => {
// eslint-disable-next-line no-alert
alert("Closing toast:" + componentArgs.data.title);
componentArgs.close();
},
}
]
},
});
```
You can also provide your own component:
```javascript
this.toasts.show(MyComponent, {
autoClose: false,
class: "foo",
data: { baz: 1 },
})
```
Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
Co-authored-by: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com>
Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-09-26 19:39:52 +08:00
|
|
|
position: unset !important;
|
|
|
|
margin: 0 !important;
|
|
|
|
border-radius: 0 !important;
|
|
|
|
box-shadow: unset !important;
|
|
|
|
z-index: unset !important;
|
2023-01-31 04:12:30 +08:00
|
|
|
|
2014-10-30 07:48:20 +08:00
|
|
|
.card-content {
|
2019-03-25 20:37:17 +08:00
|
|
|
padding: 10px;
|
2020-08-04 10:57:10 +08:00
|
|
|
background: rgba(var(--secondary-rgb), 0.85);
|
2014-10-30 07:48:20 +08:00
|
|
|
&:after {
|
2018-06-08 17:49:31 +08:00
|
|
|
content: "";
|
2014-10-30 07:48:20 +08:00
|
|
|
display: block;
|
|
|
|
clear: both;
|
|
|
|
}
|
2015-12-03 23:34:11 +08:00
|
|
|
a.card-huge-avatar {
|
2022-09-28 01:06:20 +08:00
|
|
|
display: block;
|
2015-12-03 23:34:11 +08:00
|
|
|
}
|
2020-07-10 08:51:43 +08:00
|
|
|
.bio {
|
|
|
|
@include line-clamp(2);
|
|
|
|
}
|
2014-10-30 07:48:20 +08:00
|
|
|
}
|
2019-03-25 20:37:17 +08:00
|
|
|
.card-row:not(.first-row) {
|
|
|
|
margin-top: 0.5em;
|
|
|
|
}
|
|
|
|
// avatar - names - controls
|
|
|
|
.first-row {
|
|
|
|
.names {
|
|
|
|
padding-left: 1.25em;
|
2019-04-19 16:53:23 +08:00
|
|
|
|
|
|
|
.user-profile-link {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2022-09-28 01:06:20 +08:00
|
|
|
|
2022-10-19 02:15:42 +08:00
|
|
|
&:focus-visible {
|
2022-09-28 01:06:20 +08:00
|
|
|
border: 1px solid;
|
|
|
|
@include default-focus;
|
|
|
|
}
|
2019-04-19 16:53:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.d-icon {
|
|
|
|
margin: 0 0.25em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.name-username-wrapper {
|
|
|
|
margin-right: 0;
|
|
|
|
flex: 0 1 auto;
|
2024-07-02 04:29:18 +08:00
|
|
|
@include ellipsis;
|
2019-04-19 16:53:23 +08:00
|
|
|
}
|
2019-03-25 20:37:17 +08:00
|
|
|
span {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.usercard-controls {
|
|
|
|
list-style-type: none;
|
|
|
|
margin: 0;
|
|
|
|
button {
|
|
|
|
width: 100%;
|
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
2014-07-25 05:15:40 +08:00
|
|
|
}
|
2019-03-25 20:37:17 +08:00
|
|
|
.btn {
|
|
|
|
margin-bottom: 5px;
|
|
|
|
}
|
2024-07-17 00:32:53 +08:00
|
|
|
.names__primary {
|
2022-10-12 22:05:42 +08:00
|
|
|
line-height: var(--line-height-medium);
|
2024-07-17 00:32:53 +08:00
|
|
|
font-size: var(--font-up-5);
|
|
|
|
font-weight: bold;
|
2018-11-27 05:49:57 +08:00
|
|
|
.d-icon {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2014-11-02 10:58:18 +08:00
|
|
|
}
|
2013-10-04 00:51:30 +08:00
|
|
|
}
|
2024-07-17 00:32:53 +08:00
|
|
|
.names__secondary {
|
|
|
|
font-size: var(--font-up-1);
|
|
|
|
}
|
|
|
|
.metadata {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
gap: 0.15em 0.5em;
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2019-04-12 19:55:01 +08:00
|
|
|
&.email,
|
2019-03-25 20:37:17 +08:00
|
|
|
.desc,
|
|
|
|
a {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary-high);
|
2019-03-25 20:37:17 +08:00
|
|
|
}
|
|
|
|
}
|
2024-07-17 00:32:53 +08:00
|
|
|
|
|
|
|
.names__secondary,
|
|
|
|
[class*="metadata__"] {
|
2018-05-09 03:38:55 +08:00
|
|
|
margin: 0;
|
2019-11-07 03:00:29 +08:00
|
|
|
@include ellipsis;
|
2019-03-25 20:37:17 +08:00
|
|
|
}
|
2024-07-17 00:32:53 +08:00
|
|
|
.names__primary,
|
|
|
|
.names__secondary {
|
2013-10-08 23:28:32 +08:00
|
|
|
a {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2013-10-08 23:28:32 +08:00
|
|
|
}
|
2013-10-04 00:51:30 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
p {
|
|
|
|
margin: 0 0 5px 0;
|
2014-02-11 01:30:36 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
2013-10-04 00:51:30 +08:00
|
|
|
|
2019-03-25 20:37:17 +08:00
|
|
|
// styles for user cards only
|
2020-02-13 17:58:17 +08:00
|
|
|
.user-card {
|
2019-03-20 17:45:49 +08:00
|
|
|
// avatar - names - controls
|
|
|
|
.first-row {
|
|
|
|
display: flex;
|
|
|
|
.avatar-placeholder {
|
2023-06-01 23:17:44 +08:00
|
|
|
width: var(--avatar-width);
|
|
|
|
height: var(--avatar-width);
|
2014-07-02 20:56:09 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
.user-card-avatar {
|
2023-06-01 23:17:44 +08:00
|
|
|
margin-top: var(--avatar-margin);
|
|
|
|
max-height: var(--avatar-width);
|
|
|
|
}
|
|
|
|
.avatar {
|
2023-06-02 02:30:49 +08:00
|
|
|
width: var(--avatar-width);
|
|
|
|
height: var(--avatar-width);
|
2014-11-05 03:25:35 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
.new-user a {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary-low-mid);
|
2014-11-04 00:59:29 +08:00
|
|
|
}
|
2014-07-01 05:41:38 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
// user bio - suspension reason
|
|
|
|
.second-row {
|
|
|
|
max-height: 150px;
|
|
|
|
overflow: auto;
|
|
|
|
.bio {
|
2022-11-24 06:35:57 +08:00
|
|
|
a:not(.mention) {
|
|
|
|
color: var(--tertiary);
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
|
|
|
.overflow {
|
|
|
|
max-height: 60px;
|
|
|
|
overflow: hidden;
|
2016-04-19 11:59:38 +08:00
|
|
|
}
|
2016-04-13 14:13:51 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
.suspended {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--danger);
|
2019-03-20 17:45:49 +08:00
|
|
|
.suspension-reason-title,
|
|
|
|
.suspension-date {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
2018-02-10 05:55:43 +08:00
|
|
|
}
|
2023-05-16 02:45:26 +08:00
|
|
|
.profile-hidden,
|
|
|
|
.inactive-user {
|
2022-10-12 21:31:59 +08:00
|
|
|
font-size: var(--font-up-1);
|
2019-04-01 16:50:48 +08:00
|
|
|
margin-top: 0.5em;
|
|
|
|
}
|
2016-04-13 14:13:51 +08:00
|
|
|
}
|
2019-12-10 03:15:47 +08:00
|
|
|
// featured topic
|
|
|
|
.featured-topic {
|
|
|
|
.desc {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary-high);
|
2019-12-10 03:15:47 +08:00
|
|
|
}
|
|
|
|
a {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2019-12-10 03:15:47 +08:00
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-20 17:45:49 +08:00
|
|
|
// location and website
|
2019-12-10 03:15:47 +08:00
|
|
|
.location-and-website {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
width: 100%;
|
|
|
|
align-items: center;
|
|
|
|
.location,
|
|
|
|
.website-name {
|
2018-04-14 08:43:18 +08:00
|
|
|
display: flex;
|
2019-12-10 03:15:47 +08:00
|
|
|
overflow: hidden;
|
2018-04-14 08:43:18 +08:00
|
|
|
align-items: center;
|
2019-12-10 03:15:47 +08:00
|
|
|
.d-icon {
|
|
|
|
margin-right: 0.25em;
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
2018-04-14 08:43:18 +08:00
|
|
|
}
|
2019-12-10 03:15:47 +08:00
|
|
|
.website-name a,
|
|
|
|
.location span {
|
|
|
|
@include ellipsis;
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2019-12-10 03:15:47 +08:00
|
|
|
}
|
2020-04-28 08:13:59 +08:00
|
|
|
.location,
|
|
|
|
.local-time,
|
|
|
|
.website-name {
|
2019-12-10 03:15:47 +08:00
|
|
|
margin-right: 0.5em;
|
|
|
|
}
|
|
|
|
.website-name a {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
2018-04-14 08:43:18 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
// custom user fields
|
2019-12-10 03:15:47 +08:00
|
|
|
.public-user-fields {
|
|
|
|
margin: 0;
|
2021-09-01 02:08:04 +08:00
|
|
|
.user-field-value-list-item:not(:last-of-type) {
|
|
|
|
&:after {
|
|
|
|
// create comma separated list
|
|
|
|
content: ",";
|
|
|
|
}
|
|
|
|
}
|
2013-10-04 00:51:30 +08:00
|
|
|
}
|
2019-12-10 03:15:47 +08:00
|
|
|
|
2019-03-20 17:45:49 +08:00
|
|
|
// badges
|
2019-12-10 03:15:47 +08:00
|
|
|
.badge-section {
|
2021-06-22 23:58:03 +08:00
|
|
|
line-height: 0;
|
2019-12-10 03:15:47 +08:00
|
|
|
.user-badge {
|
|
|
|
@include ellipsis;
|
2020-08-04 10:57:10 +08:00
|
|
|
background: var(--primary-very-low);
|
|
|
|
border: 1px solid var(--primary-low);
|
|
|
|
color: var(--primary);
|
2019-12-10 03:15:47 +08:00
|
|
|
}
|
2021-02-12 02:41:58 +08:00
|
|
|
.user-card-badge-link {
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
2021-06-22 23:58:03 +08:00
|
|
|
.user-card-badge-link,
|
2019-12-10 03:15:47 +08:00
|
|
|
.more-user-badges {
|
2021-07-19 09:30:35 +08:00
|
|
|
vertical-align: top;
|
2021-06-22 23:58:03 +08:00
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
.more-user-badges a {
|
|
|
|
@extend .user-badge;
|
2014-03-28 16:49:30 +08:00
|
|
|
}
|
2018-08-27 11:16:48 +08:00
|
|
|
}
|
2024-07-17 00:32:53 +08:00
|
|
|
|
|
|
|
.user-status {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
img.emoji {
|
|
|
|
margin-bottom: 1px;
|
|
|
|
margin-right: 0.3em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.relative-date {
|
|
|
|
flex: 1 0 auto;
|
|
|
|
text-align: left;
|
|
|
|
font-size: var(--font-down-3);
|
|
|
|
padding-top: 0.5em;
|
|
|
|
margin-left: 0.6em;
|
|
|
|
color: var(--primary-medium);
|
|
|
|
}
|
|
|
|
|
|
|
|
&__description {
|
|
|
|
@include ellipsis;
|
|
|
|
}
|
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
2014-03-28 16:49:30 +08:00
|
|
|
|
2019-03-25 20:37:17 +08:00
|
|
|
// styles for group cards only
|
2020-02-13 17:58:17 +08:00
|
|
|
.group-card {
|
2019-03-20 17:45:49 +08:00
|
|
|
// avatar - names and controls
|
|
|
|
.first-row {
|
2018-12-15 11:16:18 +08:00
|
|
|
display: flex;
|
2019-03-20 17:45:49 +08:00
|
|
|
.group-card-avatar {
|
2023-06-01 23:17:44 +08:00
|
|
|
margin-top: var(--avatar-margin);
|
2014-03-28 16:49:30 +08:00
|
|
|
}
|
2019-03-25 20:37:17 +08:00
|
|
|
.avatar-flair {
|
|
|
|
display: flex;
|
|
|
|
background-size: contain;
|
2020-03-07 05:42:32 +08:00
|
|
|
background-repeat: no-repeat;
|
2023-06-01 23:17:44 +08:00
|
|
|
width: var(--avatar-width);
|
|
|
|
height: var(--avatar-width);
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2019-03-25 20:37:17 +08:00
|
|
|
.d-icon {
|
|
|
|
margin: auto;
|
2023-06-06 00:57:33 +08:00
|
|
|
font-size: calc(var(--avatar-width) / 1.5);
|
2019-03-25 20:37:17 +08:00
|
|
|
}
|
|
|
|
&.rounded {
|
|
|
|
border-radius: 50%;
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
2014-04-16 18:02:57 +08:00
|
|
|
}
|
2014-04-14 13:58:36 +08:00
|
|
|
}
|
2019-03-20 17:45:49 +08:00
|
|
|
// group bio
|
|
|
|
.second-row {
|
|
|
|
max-height: 150px;
|
|
|
|
overflow: auto;
|
|
|
|
.bio {
|
2022-11-24 06:35:57 +08:00
|
|
|
a:not(.mention) {
|
|
|
|
color: var(--tertiary);
|
2019-03-20 17:45:49 +08:00
|
|
|
}
|
|
|
|
img {
|
|
|
|
max-width: 100%;
|
|
|
|
height: auto;
|
|
|
|
}
|
|
|
|
.overflow {
|
|
|
|
max-height: 60px;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
}
|
2017-11-24 05:38:11 +08:00
|
|
|
}
|
2014-04-14 13:58:36 +08:00
|
|
|
}
|