AWS |
AWS Partner Network (APN) Blog |
Create AWS Accounts and Align to the CIS AWS Foundations Benchmark with Stax |
https://aws.amazon.com/blogs/apn/create-aws-accounts-and-align-to-the-cis-aws-foundations-benchmark-with-stax/
|
Create AWS Accounts and Align to the CIS AWS Foundations Benchmark with StaxLearn how the CIS AWS Foundations Benchmark helps organizations operate securely whilst examining the common challenges businesses face in its implementation Stax can offer a solution to speed up AWS account creation while adhering to the CIS AWS Foundations Benchmark Creating and configuring AWS accounts securely can be a time consuming and tedious exercise Competing priorities can result in rushed or inconsistent process impacting security agility and velocity |
2022-06-22 20:14:51 |
海外TECH |
MakeUseOf |
8 Hypnotherapy Apps That Can Guide You Into a Peaceful State |
https://www.makeuseof.com/best-hypnotherapy-apps/
|
peaceful |
2022-06-22 20:45:15 |
海外TECH |
MakeUseOf |
Why the Free-to-Play Fall Guys Has Disappeared From Steam |
https://www.makeuseof.com/why-fall-guys-disappeared-from-steam/
|
disappeared |
2022-06-22 20:34:23 |
海外TECH |
MakeUseOf |
9 Signs You're Not a Good Fit for Remote Work |
https://www.makeuseof.com/signs-not-good-fit-remote-work/
|
Signs You x re Not a Good Fit for Remote WorkAlmost everyone nowadays wants to do remote work However remote work isn t for everyone Here are some signs that you re not suited for remote work |
2022-06-22 20:15:14 |
海外TECH |
DEV Community |
React Native - How to build a simple and scalable app theming strategy |
https://dev.to/alexandrughinea/react-native-how-to-build-a-simple-and-scalable-app-theming-strategy-4427
|
React Native How to build a simple and scalable app theming strategyReact Native How to build a simple and scalable app theming strategyWelcome to yet another entry from my React Native series This time around we ll build together a complete theming strategy for your app that is easily configurable scalable and is a plug and play solution to almost any React Native project In this part of the series we will build a practical solution to our theming needs ️Shameless promotion before going any further be sure to read my React Native How to approach design collaboration with Figma to get a better view of what we will try to achieve In this post we will not use any of the already amazing libraries out there but instead we ll explore how to build one and maybe learn something new Acknowledging challengesMore and more apps need to support different accessibility setups in terms of typography and colours Integrating design updates can be a difficult task Maintaining a design system which needs to be aware of multiple themes can be an overwhelming tasks for most Decorators Providers Proxies Hooks and FixturesWhat a word salad right These are some of the main ingredients that we will use during the course of this journey We ll unpack every item in the list one by one no worries The key components of our theming strategy need to support use cases like Being able to inject theme information typography colour namespaces colour information spacing information etc We ll be implementing the solution to both classes and functions by leveraging the Inversion of Control pattern As you guessed it we will be writing our own decorators and hooks for this Then as we also expose setters getters and other data on the React Context object we would also need to guard this theme context object from any potential malformed mutation bad entries values deletions etc We will be leveraging the Proxy and Reflection APIs this is where we ll learn and write our context with Proxy objects Be careful if you have hermes enabled in your build please take a look here first Hermes Language Features In order for Reflection Reflect and Proxy to work you need to use hermes or above Often overlooked the fixtures files Carefully decoupling and organising our theme s core data structures in separated fixture files each with its own concern so that they get updated tested and configured with ease Let s jump right in It s often a good practice to think in advance about the APIs that we try to build and what we want to achieve think of this process step as scope boxing This is where we decide on how we want to expose the theme information to our components and how a component can interact with our theme context Here is how I would want to consume a theme and have access to its properties and methods but also benefit from it automatically switching to the appropriate theme mappings fonts colour sets etc WithTheme Notice this bad body here if you re into that I got you class App extends React Component lt AppProps AppState gt render const theme this props gt theme is guaranteed by the WithTheme class decorator If you don t resonate with the decorator pattern think of it as a higher order function and that would work the same const styleView backgroundColor theme primaryBackgroundColor gt This is how a theme backround colour would be consumed const styleText theme fonts BodyRegular gt This is how I would want an entire typography style applied family size letter spacing etc color theme primaryFontColor gt This is how I would subscribe to a theme colour the actual color value depending on which theme is active will be handled in the context itself return lt View style styleView gt lt Text style styleText gt Hello world lt Text gt lt View gt Our files and folders structure The main focus for us today is to have our theme provider setup together with our fixtures sorted out ├ーproviders│ ├ーindex ts│ └ーtheme│ ├ーThemeContext Provider const ts│ └ーThemeContext Provider tsx├ーtheme│ ├ーfixtures│ │ ├ーcolors json│ │ ├ーcolors standard json│ │ ├ーtypography json│ │ └ーthemes json│ ├ーindex ts│ ├ーtheme const ts│ ├ーtheme test ts│ ├ーtheme ts│ └ーtheme utils tsx The fixtures that we ll use and what role they actually playAlthough their file name is self explanatory we ve covered in detail the contents and purpose of these files and how they get generated in the React Native How to approach design collaboration with Figma post Besides these basic but very important fixtures the second most fixture is the one that maps our Figma namespaces directly with the theme variants light dark or whatever we need because we re dealing with a hash map at the end of the day For simplicity s sake each theme variant holds the following information Three font colour variants two colour alternatives and a disabled colour version for that specific theme variant it really depends on your design Three background colour variants Three border colour variants Optional box shadow colour information depends on the design you have but usually shadow is important to communicate elevation and it does not hurt to have it declared here As you can see below this pattern is repeated for each theme variant and this is very important as we will see later It allows us to be consistent with our style data in our entire components library class Theme version light primaryFontColor Color secondaryFontColor Color disabledFontColor Color primaryBackgroundColor fff secondaryBackgroundColor Grey disabledBackgroundColor Grey primaryBorderColor Grey secondaryBorderColor Grey disabledBorderColor Grey disabledColor Grey boxShadowColor rgba dark primaryFontColor ColorAlternative secondaryFontColor ColorAlternative disabledFontColor ColorAlternative primaryBackgroundColor fff secondaryBackgroundColor ColorAlternative disabledBackgroundColor ColorAlternative primaryBorderColor ColorAlternative secondaryBorderColor ColorAlternative disabledBorderColor ColorAlternative disabledColor ColorAlternative boxShadowColor rgba The following code is something like a bridge between our existing exported fixtures and our final component context object It is our chance to describe exactly what we want from our React context structure To simplify it prepares the context object to be consumed It is also a great place to start writing tests around it theme ts import Themes from fixtures themes json import Colors from fixtures colors json import ColorsStandard from fixtures colors standard json import Typography from fixtures typography json const ThemeFixtureProvider ThemeFixtureProvider gt const light dark Themes const colors FixtureColor merge ColorsStandard Colors const typography FixtureTypography Typography const platformTypography font in ThemePlatformTypography ThemePlatformTypographyProps Typography getPlatform Extra step here to traverse and process your fixtures scale your fonts or normalise your colour information etc fancyColourProcessor colors fancyTypographyProcessor platformTypography return ThemeModes Light light colors typography platformTypography ThemeModes Dark dark colors typography platformTypography You can add other keys here but having at least these two will help us work more easily with most platforms web amp native as these property names light dark are ubiquitous Writing our React context with Proxy and object reflection What are proxies In a nutshell you can think of them as objects that can wrap themselves around your original object and then intercept any activity like set or get properties for your original object structure This is ideal if you want to protect the original object from any malformed data or enforce some sort of validation when setting or getting properties Here s a short example where we implement a custom get handler for our example and we then intercept the name of the property that we want to access and overwrite the return value for the prop prop case const originalObject prop ABC prop DEF const proxyHandler get target prop receiver gt if prop prop return return target prop const proxyExample new Proxy originalObject proxyHandler console log proxyExample proxyExample prop ABC console log proxyExample proxyExample prop As you can see the original object remains intact console log originalObject proxyExample prop DEF This mechanism turns out to be ideal for constructing our theme related React context as we need to do some nice validations against this object eg check that actual theme keys exist before setting them etc Having these extra validations and fallback mechanisms will make the app much more resilient to crashes trust me Now that we have our theme context structure defined see the ThemeFixtureProvider above amp know how to use a Proxy object we can easily hook up everything in our React context object Writing our React ProviderThis step should be self explanatory We will build a React context based on what we ve previously explored namely a theme context structure wrapped by a Proxy object If you are not familiar with this powerful pattern please read the official documentation for the Context first just to make sure you have everything fresh in your mind as we progress import React useEffect useMemo from react import useColorScheme from react native import Theme ThemeFixtureProvider ThemeModes from themes import ThemeContext from ThemeContext Provider const interface PropsThemeContextProvider children React ReactChildren onChange themeId ThemeModes gt Theme const themeContextProxyHandler description A simple getter interceptor that returns a default in case the themeId does not match what is in our original ThemeFixtureProvider get function target prop receiver if prop themeId amp amp Reflect has ThemeFixtureProvider prop return ThemeFixtureProvider Light return Reflect get arguments description A simple setter interceptor that prevents setting an inexistent themeId wrt to what is declared in ThemeFixtureProvider set function target prop receiver if prop themeId amp amp Reflect has ThemeFixtureProvider prop return Reflect get arguments const themeContextProxy new Proxy Object create null themeContextProxyHandler const ThemeContext React createContext themeContextProxy export const ThemeContextProvider props PropsThemeContextProvider gt const themeId useColorScheme Fetch the current system theme const theme useMemo lt Theme gt gt ThemeFixtureProvider themeId as ThemeModes themeId Extract the entire theme information useEffect gt props onChange theme themeId theme themeId return lt ThemeContext Provider value themeId theme gt props children lt ThemeContext Provider gt export const withThemeContext ChildComponent React FC lt any gt React ComponentClass lt any gt options any gt return props any gt lt ThemeContext Consumer gt context gt lt ChildComponent props context options gt lt ThemeContext Consumer gt Writing our class decorator and hookLet s start out with the hook implementation example Remember you would need to further evolve the hook to cover for edge cases import useContext from react import Theme ThemeFixtureProvider ThemeModes from themes import ThemeContext from providers theme ThemeContext Provider const interface UseThemeHook theme Theme themeId ThemeModes setTheme themeId ThemeModes gt Theme export function useTheme UseThemeHook const theme setTheme themeId useContext ThemeContext return theme themeId setTheme As you can see in the above example this is a pretty trivial process Now let s also cover for the class decorator example as some people still organise their code this way If you take a closer at the example code below we will use two utility functions withThemeContext and isClassComponent to make our lives easier We ll use these little utilities to make our life a little bit easier Our class decorator yes some still prefer class based implementations export function WithTheme return target new args any any any gt if isClassComponent target throw TypeError Invalid type pass a React class instead const Component withThemeContext target options return class WithThemeDecorator extends target lt any any gt render return lt Component this props gt Putting it all togetherNow that we have our list of tools complete we should just go ahead and write a basic example Basic functional component with a hook not optimised const Header React FC lt title string gt title gt const theme useTheme return lt View gt lt Text style theme typography BodyRegular color theme primaryFontColor gt title lt Text gt lt View gt Basic class component with a decorator app ts WithTheme class App extends React Component lt any any gt render const theme this props return lt View style backgroundColor theme primaryBackgroundColor gt lt Header title Hello world gt lt View gt And finally our root index example where we render our entire app structure under our ThemeContextProvider index tsexport const AppExample React FC lt any gt gt lt ThemeContextProvider gt lt App gt lt ThemeContextProvider gt Amazing Now give yourself a nice pat on the back you ve now built a scalable lightweight and flexible app theming solution that enables you to do some really cool things like being able to react to outside changes from user or system has support for adding multiple themes without touching the component code enables complete control over the colour amp typography within your app without too much hustle covers both functional and class components just in case Thanks for reading and see you in the next oneI really hope you enjoyed this post and if you like to see more content from me you can show your support by liking and following me around I ll try my best to keep articles up to date As always stay humble learn Hey if you want to buy me a coffee here s the Link |
2022-06-22 20:14:41 |
Apple |
AppleInsider - Frontpage News |
Swimmer stuck in the Columbia River uses Apple Watch to call for help |
https://appleinsider.com/articles/22/06/22/swimmer-stuck-in-the-columbia-river-uses-apple-watch-to-call-for-help?utm_medium=rss
|
Swimmer stuck in the Columbia River uses Apple Watch to call for helpA woman who became stuck while swimming in the frigid Columbia River used her Apple Watch to call emergency services which quickly came to her rescue Apple Watch swimmingThe woman was swimming in the Columbia River on June near The Dalles Oregon when her foot got caught under rocks at the river s bottom according to a report from the local police department seen by toMac Read more |
2022-06-22 20:58:58 |
Apple |
AppleInsider - Frontpage News |
Hands on with new AirPods features in iOS 16, including Personalized Spatial Audio |
https://appleinsider.com/articles/22/06/22/hands-on-with-new-airpods-features-in-ios-16-including-personalized-spatial-audio?utm_medium=rss
|
Hands on with new AirPods features in iOS including Personalized Spatial AudioWith iOS Apple is making AirPods even better These are the notable new features coming to Apple s popular earbuds and headphones in the fall AirPods on our deskEvery time Apple releases a major software update there are hundreds of changes and features to be found As has been the case in the past Apple is taking this opportunity to bring new features to its AirPods line Read more |
2022-06-22 20:09:31 |
Apple |
AppleInsider - Frontpage News |
What macOS Ventura features Intel Macs won't get, and what's coming later for Apple Silicon |
https://appleinsider.com/articles/22/06/22/what-macos-ventura-features-intel-macs-wont-get-and-whats-coming-later-for-apple-silicon?utm_medium=rss
|
What macOS Ventura features Intel Macs won x t get and what x s coming later for Apple SiliconApple s macOS Ventura will launch in the fall of and owners of Intel Macs won t be able to use some features Here s what s not coming for Intel Macs and what will arrive later for Apple Silicon Mac computers running macOS VenturaMajor features that will arrive to Mac computers are Stage Manager Continuity Camera and Passkeys Read more |
2022-06-22 20:10:28 |
海外TECH |
Engadget |
'Hyenas' is a team shooter from the creators of 'Alien: Isolation' |
https://www.engadget.com/hyenas-team-shooter-sega-203343293.html?src=rss
|
x Hyenas x is a team shooter from the creators of x Alien Isolation x Creative Assembly is best known for deliberately paced games like Alien Isolation and the Total War series but it s about jump headlong into the multiplayer action realm The developer is partnering with Sega to introduceHyenas a team based shooter coming to PS PS Xbox Series X S Xbox One and PCs in The title takes its cue from tech headlines but also doesn t take itself or its gameplay mechanics too seriously You join three person teams to raid spaceship shopping malls for the coveted merch left behind by Mars billionaires You ll have to compete against four other loot seeking teams while simultaneously dealing with security systems hired goons and zero gravity You can not only flip gravity on and off but use bridge making goo and other special abilities to claim the upper hand And yes it s pretty silly ーyou can expect appearances from Richard Nixon masks Sonic the Hedgehog merch and Pez dispensers The creators are currently accepting sign ups for a closed alpha test on PCs They ve also made clear there will be no quot pay to win quot systems While that suggests you might have the option of buying cosmetic items your success should depend solely on talent It s just a question of whether Hyenas will be good enough to pry gamers away from multiplayer shooter mainstays like the Call of Duty series or Fortnite |
2022-06-22 20:33:43 |
ニュース |
BBC News - Home |
Afghanistan quake: Taliban appeal for international aid |
https://www.bbc.co.uk/news/world-asia-61900260?at_medium=RSS&at_campaign=KARANGA
|
international |
2022-06-22 20:47:13 |
ニュース |
BBC News - Home |
Johnson hints that new coal mine for Cumbria will get go-ahead |
https://www.bbc.co.uk/news/uk-politics-61904622?at_medium=RSS&at_campaign=KARANGA
|
cumbria |
2022-06-22 20:48:09 |
ニュース |
BBC News - Home |
Eastbourne: Serena Williams & Ons Jabeur reach doubles semi-finals |
https://www.bbc.co.uk/sport/tennis/61904090?at_medium=RSS&at_campaign=KARANGA
|
finals |
2022-06-22 20:09:46 |
ニュース |
BBC News - Home |
European Under-19 Championship: England 4-0 Serbia - highlights |
https://www.bbc.co.uk/sport/av/football/61904632?at_medium=RSS&at_campaign=KARANGA
|
slovakia |
2022-06-22 20:23:15 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
キリンが社外取の「三菱の指定席」を撤廃、名門財閥の結束揺るがす“脱・三菱”の波紋 - 社外取「欺瞞のバブル」9400人の全序列 |
https://diamond.jp/articles/-/304224
|
三菱ufj銀行 |
2022-06-23 05:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
三菱商事・三井物産がLNG新規投資をためらう理由、その隙を突く「ライバル」とは? - 熾烈なるエネルギー大戦 |
https://diamond.jp/articles/-/304943
|
三井物産 |
2022-06-23 05:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
地銀・証券は再編必至、メガ銀・生損保は好調…金融主要12社の序列「5年後の未来図」 - 円安・金利高・インフレで明暗くっきり! 株価・給料・再編 5年後の業界地図 |
https://diamond.jp/articles/-/304957
|
地銀・証券は再編必至、メガ銀・生損保は好調…金融主要社の序列「年後の未来図」円安・金利高・インフレで明暗くっきり株価・給料・再編年後の業界地図金融業界の年後の序列を四つのサブセクターメガ銀・地銀・証券・生損保別に予測生損保・メガ銀が比較的好調な一方、地銀や証券は厳しい見通しにさらされる。 |
2022-06-23 05:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
日本電産が描く「デンソー対抗」半導体戦略の全貌、ルネサス出身幹部の所信表明から深読み - Diamond Premium News |
https://diamond.jp/articles/-/305215
|
diamondpremiumnews |
2022-06-23 05:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
羽田空港が大変貌!ANA・JAL発着ターミナル再編の布石?空港アナリストが分析 - 観光、復活!? |
https://diamond.jp/articles/-/305165
|
|
2022-06-23 05:05:00 |
ビジネス |
電通報 | 広告業界動向とマーケティングのコラム・ニュース |
PRプロフェッショナルが見て感じた、アドミュージアム東京の魅力 |
https://dentsu-ho.com/articles/8206
|
魅力 |
2022-06-23 06:00:00 |
北海道 |
北海道新聞 |
米大統領、支援検討を指示 アフガン地震被災者に |
https://www.hokkaido-np.co.jp/article/696973/
|
米大統領 |
2022-06-23 05:42:00 |
北海道 |
北海道新聞 |
「若き大使」が歴史遺産PR 河内長野の10人猛勉強 |
https://www.hokkaido-np.co.jp/article/696971/
|
大阪府河内長野市 |
2022-06-23 05:42:40 |
北海道 |
北海道新聞 |
アフガン地震、救助難航 資機材不足に激しい風雨 |
https://www.hokkaido-np.co.jp/article/696972/
|
風雨 |
2022-06-23 05:42:00 |
北海道 |
北海道新聞 |
減る投票所、「選挙離れ」防げ 有権者減や災害対応、対策模索 |
https://www.hokkaido-np.co.jp/article/696969/
|
市町村合併 |
2022-06-23 05:32:00 |
北海道 |
北海道新聞 |
税理士かたり申請者勧誘か 持続化給付金詐取疑いの男 |
https://www.hokkaido-np.co.jp/article/696970/
|
新型コロナウイルス |
2022-06-23 05:32:00 |
北海道 |
北海道新聞 |
対中関税「重要な手段」 米通商代表、削減に慎重 |
https://www.hokkaido-np.co.jp/article/696968/
|
通商代表 |
2022-06-23 05:12:00 |
北海道 |
北海道新聞 |
金融引き締めで景気後退も 米FRB、物価抑制優先 |
https://www.hokkaido-np.co.jp/article/696967/
|
景気後退 |
2022-06-23 05:12:00 |
ビジネス |
東洋経済オンライン |
フジテックの総会で注目、モノ言う株主の「荒技」 独自調査による反対運動は広がりをみせるか | 素材・機械・重電 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/598645?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
反対運動 |
2022-06-23 06:00:00 |
ビジネス |
東洋経済オンライン |
若手が上司に「助言」受け入れられない組織の末路 現場を「末端」と見る企業、「先端」と見る企業の差 | リーダーシップ・教養・資格・スキル | 東洋経済オンライン |
https://toyokeizai.net/articles/-/595123?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
松江英夫 |
2022-06-23 06:00:00 |
ビジネス |
東洋経済オンライン |
任天堂創業家の買収案、東洋建設「3つの反論」 株式公開買い付けの攻防戦は「第2幕」に突入へ | 建設・資材 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/598604?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
完全子会社 |
2022-06-23 05:40:00 |
ビジネス |
東洋経済オンライン |
ペットを売らないペットショップが当然になる訳 動物愛護管理法の規制が年々強化されている | ペット | 東洋経済オンライン |
https://toyokeizai.net/articles/-/597352?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
動物愛護管理法 |
2022-06-23 05:20:00 |
コメント
コメントを投稿