Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: google-amp #118

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,011 changes: 5,541 additions & 3,470 deletions .pnp.cjs

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions globals/data/src/getters/google-amp-page.getter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
type GetGoogleAmpPageProps = {
bodyContent: string
// TODO title, canonical link
}

type GetGoogleAmpPageReturnType = string

type GetGoogleAmpPageType = (props: GetGoogleAmpPageProps) => GetGoogleAmpPageReturnType

export const getGoogleAmpPage: GetGoogleAmpPageType = ({ bodyContent }) =>
`<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<title>Hello, AMPs</title>
<link rel="canonical" href="https://amp.dev/documentation/guides-and-tutorials/start/create/basic_markup/">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
</head>
<body>
${bodyContent}
</body>
</html>`
3 changes: 3 additions & 0 deletions globals/data/src/getters/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export * from './get-seo-metadata.getter.js'
export * from './aqsi-data-getter/index.js'

export * from './jsx-html-string.getter.js'
export * from './google-amp-page.getter.js'
5 changes: 5 additions & 0 deletions globals/data/src/getters/jsx-html-string.getter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const getJsxHtmlString = async (component: JSX.Element): Promise<string> => {
const ReactDOMServer = (await import('react-dom/server')).default
const staticMarkup = ReactDOMServer.renderToStaticMarkup(component)
return staticMarkup
}
20 changes: 20 additions & 0 deletions google-amp/fragments/before-after-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/before-after-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { FC } from 'react'

import React from 'react'

export const BeforeAfterFragment: FC = () => <h1>*** before-after interfactive component</h1>
1 change: 1 addition & 0 deletions google-amp/fragments/before-after-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './before-after-fragment.component.js'
20 changes: 20 additions & 0 deletions google-amp/fragments/blog-posts-list-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/blog-posts-list-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { FC } from 'react'

import React from 'react'

export const BlogPostsList: FC = () => <h1>*** blog-posts-list-fragment</h1>
1 change: 1 addition & 0 deletions google-amp/fragments/blog-posts-list-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './blog-posts-list-fragment.component.js'
20 changes: 20 additions & 0 deletions google-amp/fragments/contacts-info-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/contacts-info-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { FC } from 'react'

import React from 'react'

export const ContactsInfoFragment: FC = () => <h1>contacts-info</h1>
1 change: 1 addition & 0 deletions google-amp/fragments/contacts-info-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './contacts-info-fragment.component.js'
20 changes: 20 additions & 0 deletions google-amp/fragments/footer-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/footer-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { FC } from 'react'

import React from 'react'

export const FooterFragment: FC = () => (
<>
<h1>*** footer-fragment</h1>
<h2>services-link</h2>
<h2>contacts-link</h2>
<h2>blog-link</h2>
<h2>contacts-list with worktime</h2>
<h2>logo-fragment/component?</h2>
</>
)
1 change: 1 addition & 0 deletions google-amp/fragments/footer-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './footer-fragment.component.js'
20 changes: 20 additions & 0 deletions google-amp/fragments/header-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/header-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { FC } from 'react'

import React from 'react'

export const HeaderFragment: FC = () => (
<>
<h2>logo</h2>
<h2>services-link</h2>
<h2>contacts-link</h2>
<h2>blog-link</h2>
<h2>target-action-link?</h2>
</>
)
1 change: 1 addition & 0 deletions google-amp/fragments/header-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header-fragment.component.js'
20 changes: 20 additions & 0 deletions google-amp/fragments/hero-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/hero-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
13 changes: 13 additions & 0 deletions google-amp/fragments/hero-fragment/src/hero-fragment.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { FC } from 'react'

import React from 'react'

export const HeroFragment: FC = () => (
<>
<h1>*** hero-fragment</h1>
<h2>title</h2>
<h2>image</h2>
<h2>contacts</h2>
<h3>target action (zapisatsa)</h3>
</>
)
1 change: 1 addition & 0 deletions google-amp/fragments/hero-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './hero-fragment.component.js'
20 changes: 20 additions & 0 deletions google-amp/fragments/map-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/map-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
1 change: 1 addition & 0 deletions google-amp/fragments/map-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './map-fragment.component.js'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { FC } from 'react'

import React from 'react'

export const MapFragment: FC = () => <h1>map</h1>
20 changes: 20 additions & 0 deletions google-amp/fragments/service-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/service-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
1 change: 1 addition & 0 deletions google-amp/fragments/service-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './service-fragment.component.js'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { FC } from 'react'

import React from 'react'

export const ServiceFragment: FC = () => (
<>
<h1>услуга</h1>
<h2>изображенияе</h2>
<h2>цена, за что цена</h2>
</>
)
20 changes: 20 additions & 0 deletions google-amp/fragments/services-list-fragment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@google-amp/services-list-fragment",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
1 change: 1 addition & 0 deletions google-amp/fragments/services-list-fragment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './services-list-fragment.component.js'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { FC } from 'react'

import React from 'react'

export const ServicesListFragment: FC = () => <h1>*** services-list-fragment</h1>
26 changes: 26 additions & 0 deletions google-amp/pages/contacts-page/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@google-amp/contacts-page",
"version": "0.0.1",
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "src/index.ts",
"dependencies": {
"@google-amp/contacts-info-fragment": "workspace:*",
"@google-amp/footer-fragment": "workspace:*",
"@google-amp/header-fragment": "workspace:*",
"@google-amp/map-fragment": "workspace:*"
},
"devDependencies": {
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
17 changes: 17 additions & 0 deletions google-amp/pages/contacts-page/src/contacts-page.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { FC } from 'react'

import React from 'react'

import { ContactsInfoFragment } from '@google-amp/contacts-info-fragment'
import { FooterFragment } from '@google-amp/footer-fragment'
import { HeaderFragment } from '@google-amp/header-fragment'
import { MapFragment } from '@google-amp/map-fragment'

export const ContactsPage: FC = () => (
<>
<HeaderFragment />
<ContactsInfoFragment />
<MapFragment />
<FooterFragment />
</>
)
1 change: 1 addition & 0 deletions google-amp/pages/contacts-page/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './contacts-page.component.js'
Loading