UNPKG

4.82 kBSCSSView Raw
1// Name: Comment
2// Description: Component to create nested comments
3//
4// Component: `uk-comment`
5//
6// Sub-objects: `uk-comment-body`
7// `uk-comment-header`
8// `uk-comment-title`
9// `uk-comment-meta`
10// `uk-comment-avatar`
11// `uk-comment-list`
12//
13// Modifier: `uk-comment-primary`
14//
15// ========================================================================
16
17
18// Variables
19// ========================================================================
20
21$comment-header-margin-bottom: $global-margin !default;
22
23$comment-title-font-size: $global-medium-font-size !default;
24$comment-title-line-height: 1.4 !default;
25
26$comment-meta-font-size: $global-small-font-size !default;
27$comment-meta-line-height: 1.4 !default;
28$comment-meta-color: $global-muted-color !default;
29
30$comment-list-margin-top: $global-large-margin !default;
31$comment-list-padding-left: 30px !default;
32$comment-list-padding-left-m: 100px !default;
33
34
35/* ========================================================================
36 Component: Comment
37 ========================================================================== */
38
39.uk-comment {
40 @if(mixin-exists(hook-comment)) {@include hook-comment();}
41}
42
43
44/* Sections
45 ========================================================================== */
46
47.uk-comment-body {
48 overflow-wrap: break-word;
49 word-wrap: break-word;
50 @if(mixin-exists(hook-comment-body)) {@include hook-comment-body();}
51}
52
53.uk-comment-header {
54 margin-bottom: $comment-header-margin-bottom;
55 @if(mixin-exists(hook-comment-header)) {@include hook-comment-header();}
56}
57
58/*
59 * Micro clearfix
60 */
61
62.uk-comment-body::before,
63.uk-comment-body::after,
64.uk-comment-header::before,
65.uk-comment-header::after {
66 content: "";
67 display: table;
68}
69
70.uk-comment-body::after,
71.uk-comment-header::after { clear: both; }
72
73/*
74 * Remove margin from the last-child
75 */
76
77.uk-comment-body > :last-child,
78.uk-comment-header > :last-child { margin-bottom: 0; }
79
80
81/* Title
82 ========================================================================== */
83
84.uk-comment-title {
85 font-size: $comment-title-font-size;
86 line-height: $comment-title-line-height;
87 @if(mixin-exists(hook-comment-title)) {@include hook-comment-title();}
88}
89
90
91/* Meta
92 ========================================================================== */
93
94.uk-comment-meta {
95 font-size: $comment-meta-font-size;
96 line-height: $comment-meta-line-height;
97 color: $comment-meta-color;
98 @if(mixin-exists(hook-comment-meta)) {@include hook-comment-meta();}
99}
100
101
102/* Avatar
103 ========================================================================== */
104
105.uk-comment-avatar {
106 @if(mixin-exists(hook-comment-avatar)) {@include hook-comment-avatar();}
107}
108
109
110/* List
111 ========================================================================== */
112
113.uk-comment-list {
114 padding: 0;
115 list-style: none;
116}
117
118/* Adjacent siblings */
119.uk-comment-list > :nth-child(n+2) {
120 margin-top: $comment-list-margin-top;
121 @if(mixin-exists(hook-comment-list-adjacent)) {@include hook-comment-list-adjacent();}
122}
123
124/*
125 * Sublists
126 * Note: General sibling selector allows reply block between comment and sublist
127 */
128
129.uk-comment-list .uk-comment ~ ul {
130 margin: $comment-list-margin-top 0 0 0;
131 padding-left: $comment-list-padding-left;
132 list-style: none;
133 @if(mixin-exists(hook-comment-list-sub)) {@include hook-comment-list-sub();}
134}
135
136/* Tablet and bigger */
137@media (min-width: $breakpoint-medium) {
138
139 .uk-comment-list .uk-comment ~ ul { padding-left: $comment-list-padding-left-m; }
140
141}
142
143/* Adjacent siblings */
144.uk-comment-list .uk-comment ~ ul > :nth-child(n+2) {
145 margin-top: $comment-list-margin-top;
146 @if(mixin-exists(hook-comment-list-sub-adjacent)) {@include hook-comment-list-sub-adjacent();}
147}
148
149
150/* Style modifier
151 ========================================================================== */
152
153.uk-comment-primary {
154 @if(mixin-exists(hook-comment-primary)) {@include hook-comment-primary();}
155}
156
157
158// Hooks
159// ========================================================================
160
161@if(mixin-exists(hook-comment-misc)) {@include hook-comment-misc();}
162
163// @mixin hook-comment(){}
164// @mixin hook-comment-body(){}
165// @mixin hook-comment-header(){}
166// @mixin hook-comment-title(){}
167// @mixin hook-comment-meta(){}
168// @mixin hook-comment-avatar(){}
169// @mixin hook-comment-list-adjacent(){}
170// @mixin hook-comment-list-sub(){}
171// @mixin hook-comment-list-sub-adjacent(){}
172// @mixin hook-comment-primary(){}
173// @mixin hook-comment-misc(){}
\No newline at end of file