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

Contact us page #178

Draft
wants to merge 53 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
b22602f
add feature DVOT-272
josemarinas Dec 23, 2021
bf9dbd8
fix date in DVOT-272
josemarinas Dec 28, 2021
58b4af5
adapt the external links component DVOT-275
josemarinas Dec 28, 2021
7c8e09e
add view more button in the description DVOT-276
josemarinas Dec 28, 2021
77d91fc
add view more button in the description DVOT-276
josemarinas Dec 28, 2021
5674d15
use global colors in link button DVOT-275
josemarinas Dec 28, 2021
808a74a
adapt the results component DVOT-273
josemarinas Dec 29, 2021
a082951
update base components
josemarinas Jan 3, 2022
5ff445d
update calendar and settings card DVOT-272
josemarinas Jan 3, 2022
60072bd
adapt the results and improve the chars DVOT-273
josemarinas Jan 3, 2022
525b22f
Add the Starts in XX:XX / Ends in XX:XX information field and update …
josemarinas Jan 3, 2022
854358a
update the read more in description DVOT-276
josemarinas Jan 3, 2022
456c8ba
update tags DVOT-274
josemarinas Jan 3, 2022
523d94c
adapt spacing DVOT-280
josemarinas Jan 3, 2022
6dab036
add authenticated and disconnect banner DVOT-277
josemarinas Jan 3, 2022
bfc402f
update no results component DVOT-273
josemarinas Jan 3, 2022
7120591
update fixed mobile buttons wit new design DVOT-278
josemarinas Jan 3, 2022
e61e28d
add disconnect modal
josemarinas Jan 4, 2022
ec80494
fix bug in calendar hook
josemarinas Jan 4, 2022
73f92a1
add see results action and fix date
josemarinas Jan 4, 2022
c23a78b
add card component and update the other components to use it
josemarinas Jan 5, 2022
20f0272
add process info provider, update components v2 to use the context
josemarinas Jan 10, 2022
84d471d
add storybook docs for tag, linkbutton, col and row
josemarinas Jan 11, 2022
9114f95
fix no results subtitle
josemarinas Jan 11, 2022
e01e124
update icons in links
josemarinas Jan 11, 2022
7f233ba
fix links href
josemarinas Jan 11, 2022
eda0cc4
update calendar an settings card icons and font weight
josemarinas Jan 11, 2022
3c9b616
fix stream blinking
josemarinas Jan 11, 2022
d8bf8f5
fix countdown
josemarinas Jan 11, 2022
ff0610a
fix am pm in calendar card
josemarinas Jan 11, 2022
4ac9efb
add vertical space in the mobile version of the voting page
josemarinas Jan 11, 2022
b357764
add disabled state to LinkButton
josemarinas Jan 11, 2022
35ce2fc
fix undefined processInfo error in console
josemarinas Jan 11, 2022
7aeb34f
fix voting screen not showing
josemarinas Jan 11, 2022
14f1d81
fix results and live results
josemarinas Jan 11, 2022
a303b77
add voter info to discconnect banner
josemarinas Jan 12, 2022
cb82bbc
fix padding in results display
josemarinas Jan 12, 2022
bbb0278
add docs for elements-v2 and part of blocks-v2
josemarinas Jan 13, 2022
9e0168d
add error message when credentials are invalid
josemarinas Jan 13, 2022
5371062
add waiting messages to entity and vote creation
josemarinas Jan 17, 2022
981866a
remove test waiting banners
josemarinas Jan 17, 2022
f735be9
add mobile version and fix banner component
josemarinas Jan 18, 2022
6e95714
fix waiting banner messages transaltion
josemarinas Jan 20, 2022
a32d40c
add details and scaffold of the new admin page
josemarinas Jan 20, 2022
7f43d79
add admin page vote description settings and links
josemarinas Jan 24, 2022
908df4e
add results to admin page, update base components and add icons
josemarinas Jan 24, 2022
fe46da1
add generic modal component, update button component, tags, docs and …
josemarinas Jan 26, 2022
026353c
add rebase main branch
josemarinas Jan 27, 2022
4e3579f
add context to use-process-wrapper, delete use-process-info and use-c…
josemarinas Feb 3, 2022
7d296da
fix build and move anonymized strings code to component
josemarinas Feb 8, 2022
800632d
add ui fixes
josemarinas Feb 9, 2022
3b509aa
fix minor bugs and vote button not working
josemarinas Feb 11, 2022
1d01a4e
add contactus page, text field component and change text size, weight…
josemarinas Feb 22, 2022
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
23 changes: 23 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const path = require('path')
module.exports = {
"stories": [
"../stories/**/*.stories.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
],
"framework": "@storybook/react",
webpackFinal: async (config) => {
config.resolve.roots = [path.resolve(__dirname, '../public')];
config.resolve.plugins = [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
extensions: config.resolve.extensions,
}),
];
return config;
},
}
14 changes: 14 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<style type="text/css">
@font-face {
font-family: 'Manrope';
font-weight: bold;
font-style: normal;
src: url('fonts/manrope-bold.woff2') format("woff2");
}
@font-face {
font-family: 'Manrope';
font-weight: normal;
font-style: normal;
src: url('fonts/manrope-regular.woff2') format("woff2");
}
</style>
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
9 changes: 9 additions & 0 deletions .storybook/processDecorator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// themeDecorator.js
import React from 'react'
import { UseProcessProvider, useProcess } from '@vocdoni/react-hooks'

const processDecorator = (storyFn) => {
return <UseProcessProvider>{storyFn()}</UseProcessProvider>
}

export default processDecorator
129 changes: 129 additions & 0 deletions components/blocks-v2/banner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { Card } from "@components/elements-v2/card";
import { useIsMobile } from "@hooks/use-window-size";
import { ReactNode } from "react";
import { CardVariant, Spacer, Text, TextProps, Button, ButtonProps, Col, Row, JustifyOptions, RowGutter } from "../elements-v2";


export interface BannerProps {
/**
* Children
*/
children: string | ReactNode
/**
* React node with the image
*/
image?: ReactNode
/**
* Card components variants are accepted
*/
variant?: CardVariant
/**
* Object with the button props, icons are
* accepted
*/
buttonProps?: ButtonProps
/**
* Object with the text props for the title
* only `size` and `weight` are supported
*/
subtitleProps?: TextProps
/**
* Object with the text props for the subtitle
* only `size` and `weight` are supported
*/
titleProps?: TextProps
/**
* Padding of the card
* md -> 24px 40px desktop (default)
* 20px mobile
* lg -> 32px 48px desktop
* 20px mobile
* @type {BannerPadding}
*/
padding?: BannerPadding
/**
* Gutter of the main row
*
* @type {RowGutter}
*/
gutter?: RowGutter
innerGutter?: RowGutter
}
type BannerPadding = 'md' | 'lg'
const getBannerPadding = (isMobile: boolean, padding?: BannerPadding) => {
switch (padding) {
case 'lg':
if (isMobile) {
return '20px'
}
return '32px 48px'

default:
if (isMobile) {
return '20px'
}
return '24px 40px'
}
}
const getInnerRowGutter = (isMobile: boolean, gutter?: RowGutter) => {
if (gutter) {
return gutter
}
if (isMobile) {
return 'md'
}
return 'lg'
}
export const Banner = (props: BannerProps) => {
const isMobile = useIsMobile()
return (
<Card
// padding={getBannerPadding(isMobile, props.padding)}
variant={props.variant ? props.variant : "primary"}
>
<Row align='center' justify="space-between" gutter={props.gutter ? props.gutter : 'md'}>
<Col xs={12} md={props.buttonProps ? 9 : 12}>
<Row gutter={getInnerRowGutter(isMobile, props.innerGutter)} align="center" wrap={false} >
{props.image &&
<Col>
{props.image}
</Col>
}
<Col>
<Row gutter="xs">
<Col xs={12}>
<Text
weight={props?.titleProps?.weight ? props?.titleProps?.weight : 'bold'}
size={props?.titleProps?.size ? props?.titleProps?.size : 'md'}
color={props?.titleProps?.color ? props?.titleProps?.color : 'dark-blue'}
>
{props.children}
</Text>
</Col>
<Col xs={12} hidden={props.subtitleProps === undefined}>
<Text
weight={props?.subtitleProps?.weight ? props?.subtitleProps?.weight : 'regular'}
size={props?.subtitleProps?.size ? props?.subtitleProps?.size : 'sm'}
color={props?.subtitleProps?.color ? props?.subtitleProps?.color : 'dark-blue'}
>
{props?.subtitleProps?.children}
</Text>
</Col>
</Row>
</Col>
</Row>
</Col>
{props.buttonProps &&
<Col xs={12} md={3}>
<Button
{...props.buttonProps}
>
{props.buttonProps.children}
</Button>
</Col>
}
</Row>
</Card >
)
}

87 changes: 87 additions & 0 deletions components/blocks-v2/disconnect-modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { Modal } from "react-rainbow-components"
import { ModalProps } from "react-rainbow-components/components/Modal"
import styled from "styled-components"
import { useRef } from "react"
import { useIsMobile } from "@hooks/use-window-size"
import { Spacer, Button, Text, Col, Row } from "@components/elements-v2"
import { theme } from "@theme/global"
import { useTranslation } from "react-i18next"
import { LogOutIcon } from "@components/elements-v2/icons"
type StyledModalProps = {
isMobile: boolean
}
export interface DisconnectModalProps extends ModalProps {
onClose?: () => void
onDisconnect?: () => void
}
export const DisconnectModal = (props: DisconnectModalProps) => {
const modal = useRef(null)
const isMobile = useIsMobile()
const { i18n } = useTranslation()
if (modal.current?.containerRef?.current) {
modal.current.containerRef.current.style.backgroundColor = 'rgba(13, 71, 82, 0.86)'
}
return (
<StyledModal isMobile={isMobile} ref={modal} {...props} size='medium'>
<Row justify="center" gutter={isMobile ? 'md' : 'lg'}>
<Col xs={12}>
{/** HEADER */}
<Row justify="center" align="center" gutter="md">
<Col xs={12}>
<Row justify="center">
<Col>
<LogOutIcon
size={isMobile ? '48px' : '72px'}
/>
</Col>
</Row>
</Col>
<Col xs={12} justify="center">
<Text size="2xl" weight="medium" color="error">
{i18n.t("vote.disconnect_modal_title")}
</Text>
</Col>
</Row>
</Col>
<Col xs={12} justify="center">
<Text align="center" size="md" color="dark-gray">
{i18n.t("vote.disconnect_modal_subtitle")}
</Text>
</Col>
<Col xs={12}>
<Spacer size="md" direction="vertical" />
</Col>
<Col xs={12}>
<Row justify='space-between'>
{/** ACTIONS */}
<Col>
<Button
variant='outlined'
color={theme.warningText}
onClick={() => props.onDisconnect()}
>
{i18n.t("vote.disconnect_modal_confirm_button")}
</Button>
</Col>
<Col>
<Button
variant='white'
onClick={() => props.onRequestClose()}>
{i18n.t("vote.disconnect_modal_back_button")}
</Button>
</Col>
</Row >
</Col>
</Row>
</ StyledModal >
)
}
const getPadding = (props: StyledModalProps) => {
if (props.isMobile) {
return '32px 24px'
}
return '48px 64px'
}
const StyledModal = styled(Modal) <StyledModalProps>`
padding: ${getPadding};
`
4 changes: 4 additions & 0 deletions components/blocks-v2/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './banner'
export * from './disconnect-modal'
export * from './waiting-banner'
export * from './process-status-label'
98 changes: 98 additions & 0 deletions components/blocks-v2/modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { Modal as RainbowModal } from "react-rainbow-components"
import { ModalProps as RainbowModalProps } from "react-rainbow-components/components/Modal"
import styled from "styled-components"
import { useEffect, useRef } from "react"
import { useIsMobile } from "@hooks/use-window-size"
import { Spacer, Button, Text, Col, Row } from "@components/elements-v2"
import { theme } from "@theme/global"
import { useTranslation } from "react-i18next"
import { AvailableIcons, Icon, LogOutIcon } from "@components/elements-v2/icons"
import { colorsV2 } from "@theme/colors-v2"
type StyledModalProps = {
isMobile: boolean
}
export interface ModalProps extends RainbowModalProps {
onAccept?: () => void
icon: AvailableIcons
title: string
subtitle: string
acceptIcon: AvailableIcons
acceptText: string
loading?: boolean
closeText: string
}
export const Modal = (props: ModalProps) => {
const modal = useRef(null)
const isMobile = useIsMobile()
useEffect(() => {
if (modal.current?.containerRef?.current) {
modal.current.containerRef.current.style.backgroundColor = 'rgba(13, 71, 82, 0.86)'
}
}, [props.isOpen])
const { title, ...newProps } = props;
return (
<StyledModal isMobile={isMobile} ref={modal} {...newProps} size='medium' >
<Row justify="center" gutter={isMobile ? 'md' : 'lg'}>
<Col xs={12}>
{/** HEADER */}
<Row justify="center" align="center" gutter="md">
<Col xs={12}>
<Row justify="center">
<Col>
<Icon
color={colorsV2.support.critical[600]}
name={props.icon}
size={isMobile ? 48 : 72}
/>
</Col>
</Row>
</Col>
<Col xs={12} justify="center">
<Text size="2xl" weight="medium" color='error'>
{title}
</Text>
</Col>
</Row>
</Col>
<Col xs={12} justify="center">
<Text align="center" size="md" color="dark-gray" innerHTML={props.subtitle} />
</Col>
<Col xs={12}>
<Spacer size="md" direction="vertical" />
</Col>
<Col xs={12}>
<Row justify='space-between'>
{/** ACTIONS */}
<Col>
<Button
variant='outlined'
loading={props.loading}
color={colorsV2.support.critical[600]}
onClick={() => props.onAccept()}
>
{props.acceptText}
</Button>
</Col>
<Col>
<Button
variant='white'
disabled={props.loading}
onClick={() => props.onRequestClose()}>
{props.closeText}
</Button>
</Col>
</Row >
</Col>
</Row>
</ StyledModal >
)
}
const getPadding = (props: StyledModalProps) => {
if (props.isMobile) {
return '32px 24px'
}
return '48px 64px'
}
const StyledModal = styled(RainbowModal) <StyledModalProps>`
padding: ${getPadding};
`
Loading