AMP: можно ли всегда показывать уведомление, используя amp-user-messages? - PullRequest
1 голос
/ 15 апреля 2020

Я реализовал amp-user-notification, я создал конечную точку для вызова, чтобы всегда показывать уведомление. Но если пользователь нажимает «Отклонить», он больше не отображается, только если я очищаю локальное хранилище. Моя реализация:

<style amp-custom>
  :root {
    --space-2: 1rem;   /* 16px */
  }
  amp-user-notification {
    top: 132px;
    bottom: inherit;
  }

  @media screen and (max-width: 768px) {
    amp-user-notification {
      top: 90px;    
    }
  }

  /* Center the notification content */
  amp-user-notification.sample-notification {
    padding: 10px;
    margin-right: 30px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    color: rgb(51, 51, 51);
    font-family: Arial, Helvetica, sans-serif;  
  }
  amp-user-notification.sample-notification > button {
    padding: 4px 5px;
    text-decoration: none;
    color: #303030;  
    font-size: 12px;
    margin-right: 25px;
    border-radius: 18px;
  }
  amp-user-notification > p > span {
    display: inline;
    color: rgb(13, 84, 162);
    font-weight: 600;
  }
</style>

<amp-user-notification
  data-show-if-href="https://my-web-site.com.br/dismissable.php"  
  id="my-notification"
  class="sample-notification">
    <p><span>CAROS CLIENTES</span>, entendemos a necessidade do isolamento em virtude da COVID-19. Como trabalhamos com um produto essencial, informamos que estamos <span>operando normalmente</span>. Para que você permaneça em casa seguro.
    </p>
    <button on="tap:my-notification.dismiss">&#10006;</button>
</amp-user-notification>

URL на data-show-if-href всегда возвращает:

{
    "showNotification": true
}
...