summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/content-src/styles/_feature-callout.scss
blob: d1471fc6ce85c17b187ca4b4c87939d2a057e3a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
$max-z-index: 2147483647;
// Explicitly define these colors as the CSS variables used in aboutwelcome.scss are unavailable in the browser chrome context.
$button-background: rgba(207, 207, 216, 0.33);
$button-background-dark: rgba(43, 42, 51, 1);
$button-hover-background: rgb(232, 227, 228);
$button-hover-background-dark: rgb(54, 52, 52);
$background: #FFF;
$background-dark: rgb(28, 27, 34);

.onboardingContainer.featureCallout {
  position: absolute;
  transition: opacity 0.5s ease;
  z-index: $max-z-index - 2;

  &.hidden {
    opacity: 0;
    pointer-events: none;
  }

  &,
  & .outer-wrapper {
    // auto height to allow for arrow positioning based on height
    height: auto;
  }

  // sass-lint:disable no-color-literals
  .screen {
    // override transform in about:welcome
    &:dir(rtl) {
      transform: none;
    }

    &[pos='callout'] {
      // Max value for z-index
      z-index: $max-z-index - 1;
      height: fit-content;
      min-height: unset;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);

      .logo-container {
        display: flex;
        justify-content: center;

        .brand-logo {
          margin: 30px 45px 0;

          // This may not work for all future messages, 
          // so we may want to make flipping the logo 
          // image in RTL mode configurable
          &:dir(rtl) {
            transform: rotateY(180deg);
          }
        }
      }

      .welcome-text {
        align-items: baseline;
        text-align: start;
        margin-inline: 30px;
        padding: 20px 0 0;

        h1,
        h2 {
          font-size: 0.8em;
          margin: 0;
          color: ButtonText;
        }

        h1 {
          font-weight: bold;
        }

        h2 {
          margin-block: 10px;
        }
      }

      // Secondary section is not included in callouts
      .section-secondary {
        display: none;
      }

      .section-main {
        height: fit-content;
        width: fit-content;

        .main-content {
          overflow: hidden;
          border: 1px solid #CFCFD8;
          box-shadow: 0 2px 14px rgba(58, 57, 68, 0.2);
          border-radius: 4px;
          padding-block: 0 24px;
          width: 25em;
          background-color: $background;
          @media (prefers-color-scheme: dark) {
            background-color: $background-dark;
          }

          .steps {
            align-self: baseline;
            margin: -38px 30px -30px;
            padding-block: 0;

            .indicator {
              // using border will show up in Windows High Contrast Mode to improve accessibility.
              border: 4px solid WindowText;

              &.current {
                border-color: LinkText;
              }
            }

            & .indicator.current,
            &.progress-bar .indicator.complete {
              border-color: LinkText;
            }
          }

          .dismiss-button {
            font-size: 1em;
            position: absolute;
            margin-block: 15px 0;
            margin-inline: 0 15px;
            z-index: 1;
            background-color: $background;
            @media (prefers-color-scheme: dark) {
              background-color: $background-dark;
            }
          }
        }
      }

      .action-buttons {
        margin-block: 0 16px;

        .primary,
        .secondary-cta .secondary {
          padding: 4px 16px;
          font-size: 0.8em;
          height: 2em;
        }

        .primary {
          font-weight: bold;
          float: inline-end;
          margin-inline: 10px 30px;
          padding: 4px 16px;
          font-size: 0.8em;
          line-height: 16px;
          min-height: 32px;
          background-color: $button-background;

          @media (prefers-color-scheme: dark) {
            background-color: $button-background-dark;
          }
        }

        .secondary-cta {
          float: inline-end;
        }
      }

      .action-buttons .primary,
      .main-content .dismiss-button {
        border-radius: 4px;
        border: 0;
        cursor: pointer;
        color: ButtonText;

        &:hover {
          background-color: $button-hover-background;
        }

        @media (prefers-color-scheme: dark) {
          background-color: $button-background-dark;

          &:hover {
            background-color: $button-hover-background-dark;
          }
        }

        @media (prefers-contrast) {
          border: 1px solid ButtonText;
          background-color: $background;
          @media (prefers-color-scheme: dark) {
            background-color: $background-dark;
          }

          &:hover {
            background-color: ButtonText;
            color: $background;
            @media (prefers-color-scheme: dark) {
              color: $background-dark;
            }
          }
        }
      }
    }
  }

  $arrow-size: 24px;
  $arrow-inset-size: math.div($arrow-size, 2);
  $arrow-border: 1px solid #CFCFD8;

  // applied to all callout arrow foreground and background
  &.callout-arrow::before,
  &.callout-arrow::after {
    content: '';
    position: absolute;
    width: $arrow-size;
    height: $arrow-size;
    transform: rotate(45deg);
  }

  &.callout-arrow:dir(rtl)::before,
  &.callout-arrow:dir(rtl)::after {
    transform: rotate(315deg);
  }

  // color for all arrow foreground
  &.callout-arrow::before {
    z-index: $max-z-index;
    background-color: $background;
    @media (prefers-color-scheme: dark) {
      background-color: $background-dark;
    }
  }

  // styles for all arrow backgrounds
  &.callout-arrow::after {
    background: transparent;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: -1;
  }

  // up arrow positioning
  &.arrow-top::before,
  &.arrow-top::after {
    top: -$arrow-inset-size;
    inset-inline-start: calc(50% - $arrow-inset-size);
  }

  // up arrow foreground
  &.arrow-top::before {
    border-top: $arrow-border;
    border-inline-start: $arrow-border;
  }

  // down arrow positioning
  &.arrow-bottom::before,
  &.arrow-bottom::after {
    top: calc(100% - $arrow-inset-size);
    inset-inline-start: calc(50% - $arrow-inset-size);
  }

  // down arrow foreground
  &.arrow-bottom::before {
    border-inline-end: $arrow-border;
    border-bottom: $arrow-border;
  }

  // end arrow positioning
  &.arrow-inline-end::before,
  &.arrow-inline-end::after {
    top: calc(50% - $arrow-inset-size);
    inset-inline-start: calc(100% - $arrow-inset-size);
  }

  // end arrow foreground
  &.arrow-inline-end::before {
    border-top: $arrow-border;
    border-inline-end: $arrow-border;
  }

  // start arrow positioning
  &.arrow-inline-start::before,
  &.arrow-inline-start::after {
    top: calc(50% - $arrow-inset-size);
    inset-inline-start: -$arrow-inset-size;
  }

  // start arrow foreground
  &.arrow-inline-start::before {
    border-bottom: $arrow-border;
    border-inline-start: $arrow-border;
  }

  // top-end arrow positioning
  &.arrow-top-end::before,
  &.arrow-top-end::after {
    top: -$arrow-inset-size;
    inset-inline-end: $arrow-inset-size;
  }

  // top-end arrow foreground
  &.arrow-top-end::before {
    border-top: $arrow-border;
    border-inline-start: $arrow-border;
  }

  // top-start arrow positioning
  &.arrow-top-start::before,
  &.arrow-top-start::after {
    top: -$arrow-inset-size;
    inset-inline-start: $arrow-inset-size;
  }

  // top-start arrow foreground
  &.arrow-top-start::before {
    border-top: $arrow-border;
    border-inline-start: $arrow-border;
  }
}