import React from 'react'; import { graphql, StaticQuery } from 'gatsby'; import Notification from './notification'; const NOTIFS_QUERY = graphql` query notifs { file(relativePath: { regex: "/notifications/" }) { childDataYaml { notifications { published loud message url } } } } `; const Notifications = () => ( {data => { const notifs = data.file.childDataYaml.notifications.filter(notif => notif.published); return notifs.map((node, i) => ( {node.message} )); }} ); export default Notifications;