From f282801e877462ef1d7ae5b6ef98b4445bdbdfed Mon Sep 17 00:00:00 2001 From: Priyatham Sai Chand Date: Thu, 4 Mar 2021 12:28:00 +0530 Subject: [PATCH] pricing radio --- src/components/PricingPlan.js | 38 +++++++++++++++----- src/components/Radio.js | 67 +++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 src/components/Radio.js diff --git a/src/components/PricingPlan.js b/src/components/PricingPlan.js index dca49b0..e3d74fa 100644 --- a/src/components/PricingPlan.js +++ b/src/components/PricingPlan.js @@ -1,7 +1,8 @@ -import React, { Component } from 'react'; +import React, { useState,Component } from 'react'; import NavBar from './NavBar'; import Footer from './Footer'; import styled from 'styled-components'; + const size = { mobileS: '320px', mobileM: '375px', @@ -21,10 +22,6 @@ export const Device = { desktop: `(min-width: ${size.desktop})`, desktopL: `(min-width: ${size.desktop})` }; -const WhiteContainer = styled.div` - background: white; - -`; const PricingPlanContainer = styled.div` display:flex; @@ -56,9 +53,20 @@ const Pricing = styled.section` &:hover { box-shadow: 0 0 15px rgba(0,0,0,0.4); transform: scale(1.05); + cursor: pointer; } +`; +const Radio = styled.input` + display:none; + +`; +const Label = styled.label` + display: relative; + cursor:pointer; + + `; const Text = styled.p` font-size: 0.9em; @@ -169,19 +177,23 @@ const Button = styled.a` `; -class PricingPlan extends Component { +const PricingPlan = () => { +const [pricing, setPricing] = useState(); - render() { return (
+


Pricing Plan

- + {pricing} + setPricing(event.target.value)}> + +
) - } + } export default PricingPlan; \ No newline at end of file diff --git a/src/components/Radio.js b/src/components/Radio.js new file mode 100644 index 0000000..3607203 --- /dev/null +++ b/src/components/Radio.js @@ -0,0 +1,67 @@ +import React from "react"; +import styled from "styled-components"; + +const RadioWrapper = styled.div` +`; + +const Mark = styled.span` + position: relative; + border: 1px solid #777777; + width: 14px; + height: 14px; + left: 0; + border-radius: 50%; + margin-right: 5px; + vertical-align: middle; + &::after { + content: ""; + display: block; + width: 0; + height: 0; + border-radius: 50%; + background-color: #03a9f4; + opacity: 0; + left: 50%; + top: 50%; + position: absolute; + transition: all 110ms; + } +`; + +const Input = styled.input` + position: absolute; + visibility: hidden; + display: none; + &:checked + ${Mark} { + &::after { + width: 10px; + height: 10px; + opacity: 1; + left: 12%; + top: 12%; + } + } +`; + +const Label = styled.label` + cursor: pointer; + position: relative; + ${props => + props.disabled && + ` + cursor: not-allowed; + opacity: 0.4; + `} +`; + +const Radio = ({ name, children }) => ( + + + +); + +export default Radio;