-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/CampaignsBanner' of github.com:ONLYOFFICE/AppSe…
…rver into feature/personal # Conflicts: # products/ASC.Files/Client/src/components/Article/Body/index.js
- Loading branch information
Showing
61 changed files
with
540 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Campaigns Banner | ||
|
||
Used to display an campaigns banner. | ||
|
||
### Usage | ||
|
||
```js | ||
import CampaignsBanner from "@appserver/components/campaigns-banner"; | ||
``` | ||
|
||
```jsx | ||
<CampaignsBanner /> | ||
``` | ||
|
||
### Properties | ||
|
||
| Props | Type | Required | Values | Default | Description | | ||
| ------------- | :------------: | :------: | :----: | :-----: | ----------------- | | ||
| `headerLabel` | `string` | ✅ | - | - | | | ||
| `textLabel` | `string` | ✅ | - | - | | | ||
| `img` | `string` | ✅ | - | - | | | ||
| `btnLabel` | `string` | ✅ | - | - | | | ||
| `btnLink` | `string` | ✅ | - | - | | | ||
| `className` | `string` | - | - | - | Accepts class | | ||
| `id` | `string` | - | - | - | Accepts id | | ||
| `style` | `obj`, `array` | - | - | - | Accepts css style | |
27 changes: 27 additions & 0 deletions
27
packages/asc-web-components/campaigns-banner/campaigns-banner.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from "react"; | ||
import CampaignsBanner from "./"; | ||
|
||
export default { | ||
title: "Components/CampaignsBanner", | ||
component: CampaignsBanner, | ||
parameters: { | ||
docs: { | ||
description: { | ||
component: "Used to display an campaigns banner.", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const Template = (args) => <CampaignsBanner {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
|
||
Default.args = { | ||
headerLabel: "ONLYOFFICE for business", | ||
subHeaderLabel: "Docs, projects, clients & emails", | ||
img: "static/images/campaigns.cloud.png", | ||
btnLabel: "START FREE TRIAL", | ||
link: | ||
"https://www.onlyoffice.com/ru/registration.aspx?utm_source=personal&utm_campaign=BannerPersonalCloud", | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/asc-web-components/campaigns-banner/campaigns-banner.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import { mount } from "enzyme"; | ||
import CampaignsBanner from "."; | ||
|
||
describe("<CampaignsBanner />", () => { | ||
it("renders without error", () => { | ||
const wrapper = mount( | ||
<CampaignsBanner | ||
headerLabel="ONLYOFFICE for business" | ||
textLabel="Docs, projects, clients & emails" | ||
btnLabel="START FREE TRIAL" | ||
img="static/images/campaign.cloud.png" | ||
btnLink="https://onlyoffice.com" | ||
/> | ||
); | ||
|
||
expect(wrapper).toExist(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import BannerWrapper from "./styled-campaigns-banner"; | ||
|
||
import Button from "../button"; | ||
import Text from "../text"; | ||
|
||
const onButtonClick = (url) => { | ||
window.location = url; | ||
}; | ||
|
||
const CampaignsBanner = (props) => { | ||
const { headerLabel, subHeaderLabel, img, btnLabel, link } = props; | ||
return ( | ||
<BannerWrapper> | ||
<a href={link}> | ||
<Text fontWeight="700" fontSize="13px"> | ||
{headerLabel} | ||
</Text> | ||
<Text className="banner-sub-header" fontWeight="500" fontSize="12px"> | ||
{subHeaderLabel} | ||
</Text> | ||
|
||
<img src={img} /> | ||
</a> | ||
|
||
<Button | ||
className="banner-btn" | ||
size="medium" | ||
isDisabled={false} | ||
disableHover={true} | ||
label={btnLabel} | ||
onClick={() => onButtonClick(link)} | ||
/> | ||
</BannerWrapper> | ||
); | ||
}; | ||
|
||
CampaignsBanner.propTypes = { | ||
id: PropTypes.string, | ||
className: PropTypes.string, | ||
style: PropTypes.object, | ||
headerLabel: PropTypes.string, | ||
subHeaderLabel: PropTypes.string, | ||
img: PropTypes.string, | ||
btnLabel: PropTypes.string, | ||
link: PropTypes.string, | ||
}; | ||
|
||
CampaignsBanner.defaultProps = { | ||
id: undefined, | ||
className: undefined, | ||
style: undefined, | ||
}; | ||
|
||
export default CampaignsBanner; |
45 changes: 45 additions & 0 deletions
45
packages/asc-web-components/campaigns-banner/styled-campaigns-banner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import styled from "styled-components"; | ||
|
||
const BannerWrapper = styled.div` | ||
max-width: 185px; | ||
border: 1px solid #d1d1d1; | ||
border-radius: 5px; | ||
padding: 15px; | ||
margin-top: 20px; | ||
@media screen and (max-width: 1024px) { | ||
max-width: inherit; | ||
} | ||
a { | ||
text-decoration: none; | ||
color: #000; | ||
} | ||
img { | ||
max-width: 180px; | ||
height: auto; | ||
margin-top: 10px; | ||
} | ||
.banner-sub-header { | ||
line-height: 1.5; | ||
} | ||
.banner-btn { | ||
width: 100%; | ||
color: #fff; | ||
background: #ed7309; | ||
margin-top: 15px; | ||
border: none; | ||
border-radius: 5px; | ||
} | ||
.banner-btn:active { | ||
color: #fff; | ||
background: #ed7309; | ||
border: none; | ||
} | ||
`; | ||
|
||
export default BannerWrapper; |
53 changes: 53 additions & 0 deletions
53
products/ASC.Files/Client/src/components/Article/Body/Banner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import { withRouter } from "react-router"; | ||
import { withTranslation } from "react-i18next"; | ||
import { inject, observer } from "mobx-react"; | ||
import CampaignsBanner from "@appserver/components/campaigns-banner"; | ||
import Loaders from "@appserver/common/components/Loaders"; | ||
|
||
const PureBanner = ({ t, tReady, getBannerType, bannerTypes }) => { | ||
const [bannerType, setBannerType] = useState(""); | ||
|
||
useEffect(() => { | ||
if (!localStorage.getItem("banner")) { | ||
localStorage.setItem("banner", 0); | ||
} | ||
|
||
const index = Number(localStorage.getItem("banner")); | ||
const banner = getBannerType(index); | ||
|
||
if (index + 1 === bannerTypes.length) { | ||
localStorage.setItem("banner", 0); | ||
} else { | ||
localStorage.setItem("banner", Number(index + 1)); | ||
} | ||
|
||
setBannerType(banner); | ||
}, []); | ||
|
||
if (tReady) | ||
return ( | ||
<CampaignsBanner | ||
headerLabel={t(`CampaignPersonal${bannerType}:Header`)} | ||
subHeaderLabel={t(`CampaignPersonal${bannerType}:SubHeader`)} | ||
img={`/static/images/campaigns.${bannerType}.png`} | ||
btnLabel={t(`CampaignPersonal${bannerType}:ButtonLabel`)} | ||
link={t(`CampaignPersonal${bannerType}:Link`)} | ||
/> | ||
); | ||
else return <Loaders.Rectangle />; | ||
}; | ||
|
||
const Banner = withTranslation([ | ||
"CampaignPersonalCloud", | ||
"CampaignPersonalDesktop", | ||
"CampaignPersonalEducation", | ||
"CampaignPersonalEnterprise", | ||
"CampaignPersonalIntegration", | ||
])(withRouter(PureBanner)); | ||
|
||
export default inject(({ bannerStore }) => { | ||
const { getBannerType, bannerTypes } = bannerStore; | ||
|
||
return { getBannerType, bannerTypes }; | ||
})(observer(Banner)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { makeAutoObservable } from "mobx"; | ||
|
||
class BannerStore { | ||
bannerTypes = ["Cloud", "Desktop", "Education", "Enterprise", "Integration"]; | ||
|
||
constructor() { | ||
makeAutoObservable(this); | ||
} | ||
|
||
getBannerType = (index) => { | ||
return this.bannerTypes[index]; | ||
}; | ||
} | ||
|
||
export default BannerStore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE für Business", | ||
"SubHeader": "Dokumente, Projekte, Kunden & E-Mails", | ||
"ButtonLabel": "Kostenlos testen", | ||
"Link": "https://www.onlyoffice.com/de/registration.aspx?utm_source=personal&utm_campaign=BannerPersonalCloud" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE für PC", | ||
"SubHeader": "Gratis Alternative zu MS Office", | ||
"ButtonLabel": "Herunterladen", | ||
"Link": "https://www.onlyoffice.com/de/download-desktop.aspx?utm_source=personal&utm_campaign=BannerPersonalDesktop" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE für Schulen", | ||
"SubHeader": "Endecken Sie alle Rabatte", | ||
"ButtonLabel": "Mehr erfahren", | ||
"Link": "https://www.onlyoffice.com/de/education.aspx?utm_source=personal&utm_campaign=BannerPersonalEducation" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE On-Premises", | ||
"SubHeader": "Schützen Sie Ihre Dokumente", | ||
"ButtonLabel": "Jetzt erhalten", | ||
"Link": "https://www.onlyoffice.com/de/download-commercial.aspx?utm_source=personal&utm_campaign=BannerPersonalEnterprise" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE Integration", | ||
"SubHeader": "Editoren für Ihre Plattform", | ||
"ButtonLabel": "Jetzt integrieren", | ||
"Link": "https://www.onlyoffice.com/de/connectors.aspx?utm_source=personal&utm_campaign=BannerPersonalIntegration" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE for business", | ||
"SubHeader": "Docs, projects, clients & emails", | ||
"ButtonLabel": "Start free trial", | ||
"Link": "https://www.onlyoffice.com/registration.aspx?utm_source=personal&utm_campaign=BannerPersonalCloud" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE for PC", | ||
"SubHeader": "Get a free alternative to MS Office", | ||
"ButtonLabel": "Download", | ||
"Link": "https://www.onlyoffice.com/download-desktop.aspx?utm_source=personal&utm_campaign=BannerPersonalDesktop" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE for schools", | ||
"SubHeader": "Learn about education discounts", | ||
"ButtonLabel": "Learn more", | ||
"Link": "https://www.onlyoffice.com/education.aspx?utm_source=personal&utm_campaign=BannerPersonalEducation" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"Header": "ONLYOFFICE on-premises", | ||
"SubHeader": "Keep your docs and projects safe", | ||
"ButtonLabel": "Get it now", | ||
"Link": "https://www.onlyoffice.com/download-commercial.aspx?utm_source=personal&utm_campaign=BannerPersonalEnterprise" | ||
} |
Oops, something went wrong.